:root {
    --bg-dark: #0a0a0a;
    --bg-panel: #141414;
    --bg-glass: rgba(30, 30, 30, 0.7);
    --border-color: rgba(255, 0, 51, 0.2);
    --brand-red: #ff0033;
    --brand-red-glow: rgba(255, 0, 51, 0.5);
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --message-bot: rgba(255, 0, 51, 0.1);
    --message-user: rgba(40, 40, 40, 0.8);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

h1, h2, h3 {
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
}

/* Base Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ══ Sidebar ═══════════════════════════════════════════ */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: linear-gradient(180deg, #111 0%, #0d0d0d 100%);
    border-right: 1px solid rgba(255,0,51,0.15);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    overflow: hidden;
}

/* ── Logo header (fixed at top) */
.sidebar-header {
    padding: 22px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,0,51,0.12);
    flex-shrink: 0;
    background: rgba(0,0,0,0.3);
}

.logo-icon {
    font-size: 2rem;
    color: var(--brand-red);
    text-shadow: 0 0 14px rgba(255,0,51,0.6);
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* ── Nav list (scrollable middle section) */
.nav-links {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* subtle scrollbar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,0,51,0.25) transparent;
}

.nav-links::-webkit-scrollbar { width: 3px; }
.nav-links::-webkit-scrollbar-track { background: transparent; }
.nav-links::-webkit-scrollbar-thumb {
    background: rgba(255,0,51,0.25);
    border-radius: 4px;
}
.nav-links::-webkit-scrollbar-thumb:hover {
    background: rgba(255,0,51,0.5);
}

/* ── Nav items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-secondary);
    transition: all 0.18s ease;
    border: 1px solid transparent;
    position: relative;
    user-select: none;
    white-space: nowrap;
}

.nav-item i {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item:hover {
    background: rgba(255,0,51,0.07);
    color: var(--text-primary);
    border-color: rgba(255,0,51,0.12);
    padding-left: 18px;
}

.nav-item.active {
    background: rgba(255,0,51,0.12);
    border-color: rgba(255,0,51,0.3);
    color: var(--brand-red);
    box-shadow: 0 0 12px rgba(255,0,51,0.08) inset;
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 3px;
    background: var(--brand-red);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--brand-red);
}

/* ── Divider */
.nav-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 8px 6px;
}

/* ── Nav action items (Histórico) */
.nav-action {
    margin-top: 2px;
    color: rgba(170,170,170,0.7);
}

/* ── User info bar (fixed at bottom) */
.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-top: 1px solid rgba(255,0,51,0.12);
    background: rgba(0,0,0,0.3);
    flex-shrink: 0;
    gap: 8px;
}

#logged-user-name {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.logout-btn {
    background: rgba(255,0,51,0.08);
    border: 1px solid rgba(255,0,51,0.2);
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    font-size: 1rem;
    transition: 0.18s;
    flex-shrink: 0;
}

.logout-btn:hover {
    background: rgba(255,0,51,0.2);
    color: var(--brand-red);
    border-color: var(--brand-red);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px 7px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    transition: 0.18s;
    flex-shrink: 0;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.07);
    color: var(--text-primary);
}

/* Chat Main Area */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(rgba(10, 10, 10, 0.85), rgba(10, 10, 10, 0.95)), url('https://files.nexhub.fun/api/file/view/crv9dKzv5kr0vJhgAHbiIR_xUaXo-zjx2OenpdwVDtUdXds0-XjnHt7-GVVSVL5t') no-repeat center center;
    background-size: cover;
    position: relative;
}

/* Mobile header logic */
.mobile-header {
    display: none; /* hidden on desktop */
    padding: 15px 20px;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-panel);
}

.mobile-logo {
    color: var(--brand-red);
    font-size: 1.5rem;
}

/* Chat Header */
.chat-header {
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 0, 51, 0.1);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
}

.chat-title-group {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header-icon {
    font-size: 2rem;
    color: var(--brand-red);
}

.chat-title-group h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
}

.status-indicator {
    font-size: 0.8rem;
    color: #4CAF50;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scroll-behavior: smooth;
}

/* Scrollbar customization */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--brand-red);
}

.message {
    max-width: 80%;
    animation: fadeIn 0.4s ease forwards;
    line-height: 1.5;
    word-wrap: break-word;
}

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

.message-user {
    align-self: flex-end;
    background-color: var(--message-user);
    padding: 15px 20px;
    border-radius: 15px 15px 0 15px;
    border: 1px solid #333;
}

.message-bot {
    align-self: flex-start;
    background-color: var(--message-bot);
    padding: 15px 20px;
    border-radius: 15px 15px 15px 0;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(255, 0, 51, 0.05);
}

.message pre {
    white-space: pre-wrap;
    font-family: inherit;
}

/* ── Loading block (in-place) ───────────────────── */
.msg-loading {
    min-height: 58px;
    display: flex;
    align-items: center;
}

.msg-loading-inner {
    display: flex;
    align-items: center;
    gap: 14px;
}

.msg-loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
}

.msg-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brand-red);
    display: inline-block;
    animation: msgBounce 1.4s infinite ease-in-out both;
}
.msg-loading-dots span:nth-child(1) { animation-delay: 0s; }
.msg-loading-dots span:nth-child(2) { animation-delay: 0.18s; }
.msg-loading-dots span:nth-child(3) { animation-delay: 0.36s; }

@keyframes msgBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

.msg-loading-label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    font-style: italic;
    animation: pulse 2s infinite;
}

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

/* ── Resolved result block ──────────────────────── */
.msg-resolved {
    animation: fadeIn 0.35s ease forwards;
}

.msg-result-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
}

.msg-section-header {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--brand-red);
    padding: 10px 0 4px;
    border-bottom: 1px solid rgba(255,0,51,0.15);
    margin-bottom: 4px;
}

.msg-section-header:first-child {
    padding-top: 0;
}

.msg-section-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding-left: 4px;
    margin-bottom: 6px;
}

.msg-field {
    display: flex;
    gap: 8px;
    align-items: baseline;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9rem;
    flex-wrap: wrap;
}

.msg-field-key {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 120px;
}

.msg-field-val {
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

.msg-plain {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.msg-bullet {
    font-size: 0.9rem;
    color: var(--text-secondary);
    padding-left: 8px;
    line-height: 1.6;
}

.msg-spacer {
    height: 6px;
}

.msg-empty {
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.88rem;
}

/* ── Mini callback loader (inside message block) ── */
.msg-callback-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0 4px;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 8px;
}

/* ── Old typing indicator removed — kept for safety ── */
.typing-indicator { display: none; }



/* Input Area */
.chat-input-area {
    padding: 20px 30px;
    background: rgba(20, 20, 20, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid #222;
}

.bot-selector-ui {
    background: var(--bg-card);
    color: var(--text-base);
    border: 1px solid #333;
    padding: 0 15px;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: 0.3s;
}

.bot-selector-ui:hover {
    border-color: var(--brand-red);
}

.chat-form {
    display: flex;
    gap: 15px;
    position: relative;
}

#chat-input {
    flex: 1;
    background-color: var(--bg-dark);
    border: 1px solid #333;
    padding: 15px 25px;
    border-radius: 30px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#chat-input:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.2);
}

.send-btn {
    background-color: var(--brand-red);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--brand-red-glow);
}

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

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        height: 100%;
        transform: translateX(-100%);
        box-shadow: 5px 0 15px rgba(0,0,0,0.5);
    }

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

    .mobile-header {
        display: flex;
    }

    .chat-header {
        display: none;
    }

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

/* Utilities */
.hidden {
    display: none !important;
}

.view-container {
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #111 0%, var(--bg-dark) 100%);
}

#login-view {
    background: linear-gradient(rgba(10, 10, 10, 0.7), rgba(10, 10, 10, 0.8)), url('https://files.nexhub.fun/api/file/view/A1kOqNjpMFhXvc1_AAdqfgqzUSy-FidZ_lN5o8qIAr95HttY2Ko2RRmVvY5h_aS6') no-repeat center center;
    background-size: cover;
}

.login-card {
    background: rgba(20, 20, 20, 0.85);
    backdrop-filter: blur(15px);
    padding: 40px;
    border-radius: 15px;
    border: 1px solid var(--brand-red);
    box-shadow: 0 10px 40px rgba(255,0,51,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 20px;
    animation: popIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.login-logo {
    font-size: 4rem;
    margin-bottom: -10px;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#login-form input, .input-light {
    background-color: var(--bg-dark);
    border: 1px solid #333;
    padding: 15px;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

#login-form input:focus, .input-light:focus {
    border-color: var(--brand-red);
}

/* ── Remember-me checkbox ── */
.remember-me-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    text-align: left;
    user-select: none;
}

.remember-me-label input[type="checkbox"] {
    display: none;
}

.remember-me-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid #444;
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 0.2s, background 0.2s;
    position: relative;
}

.remember-me-check::after {
    content: '';
    width: 5px;
    height: 9px;
    border: 2px solid var(--brand-red);
    border-top: none;
    border-left: none;
    transform: rotate(45deg) scaleY(0);
    transform-origin: bottom;
    transition: transform 0.15s ease;
    margin-bottom: 2px;
}

.remember-me-label input:checked + .remember-me-check {
    border-color: var(--brand-red);
    background: rgba(255,0,51,0.08);
}

.remember-me-label input:checked + .remember-me-check::after {
    transform: rotate(45deg) scaleY(1);
}

.remember-me-text {
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.remember-me-label:hover .remember-me-text { color: var(--text-primary); }
.remember-me-label:hover .remember-me-check { border-color: rgba(255,0,51,0.5); }

.primary-btn {
    background-color: var(--brand-red);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: 0.3s;
    font-weight: 600;
}

.primary-btn:hover {
    background-color: #d4002a;
    box-shadow: 0 0 15px var(--brand-red-glow);
}

.error-msg {
    color: var(--brand-red);
    font-size: 0.9rem;
}

.admin-msg {
    color: #4CAF50;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Sidebar updates */
.user-info {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 0, 51, 0.1);
}

#logged-user-name {
    font-weight: bold;
    color: var(--brand-red);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    transition: 0.3s;
}

.logout-btn:hover {
    color: var(--brand-red);
}

.nav-divider {
    height: 1px;
    background: rgba(255, 0, 51, 0.1);
    margin: 10px 15px;
}

.nav-action {
    color: var(--text-secondary);
}
.nav-action.active {
    background-color: var(--message-bot);
    color: var(--brand-red);
}

/* View Sections */
.view-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.history-container {
    background: linear-gradient(rgba(10, 10, 10, 0.85), rgba(10, 10, 10, 0.95)), url('https://files.nexhub.fun/api/file/view/crv9dKzv5kr0vJhgAHbiIR_xUaXo-zjx2OenpdwVDtUdXds0-XjnHt7-GVVSVL5t') no-repeat center center;
    background-size: cover;
    overflow-y: auto;
}

.section-header {
    padding: 30px;
    border-bottom: 1px solid rgba(255, 0, 51, 0.1);
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
}

.section-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.history-card {
    background: var(--bg-panel);
    border: 1px solid #333;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-card:hover {
    border-color: var(--brand-red);
}

.history-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.history-query {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--brand-red);
}

.history-response {
    background: var(--message-bot);
    padding: 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    white-space: pre-wrap;
    border-left: 3px solid var(--brand-red);
}

/* ── Admin Drawer ─────────────────────────────────── */
.admin-drawer {
    width: 260px;
    background: #0d0d0d;
    border-right: 1px solid rgba(255,0,51,0.18);
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: drawerSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    flex-shrink: 0;
}

@keyframes drawerSlideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to   { opacity: 1; transform: translateX(0); }
}

.admin-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 18px 16px;
    border-bottom: 1px solid rgba(255,0,51,0.12);
}

.admin-drawer-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--brand-red);
}

.admin-drawer-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.admin-section-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.admin-input {
    background: #111;
    border: 1px solid #2a2a2a;
    padding: 10px 12px;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: 'Inter', sans-serif;
}

.admin-input:focus {
    border-color: var(--brand-red);
}

.admin-role-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-role-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.admin-select {
    flex: 1;
    background: #111;
    border: 1px solid #2a2a2a;
    padding: 8px 10px;
    border-radius: 7px;
    color: var(--text-primary);
    font-size: 0.88rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

.admin-create-btn {
    background: var(--brand-red);
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 7px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
}

.admin-create-btn:hover {
    background: #cc0029;
    box-shadow: 0 0 12px rgba(255,0,51,0.35);
}

.admin-msg {
    font-size: 0.82rem;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    border-left: 3px solid currentColor;
    margin-top: 2px;
}

.admin-users-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111;
    border: 1px solid #1e1e1e;
    padding: 8px 12px;
    border-radius: 7px;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.admin-user-item:hover { border-color: rgba(255,0,51,0.3); }

.admin-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.admin-user-role {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 4px;
}

.admin-user-role.admin {
    background: rgba(255,0,51,0.15);
    color: var(--brand-red);
}

.admin-user-role.user {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

.admin-users-loading {
    color: var(--text-secondary);
    font-size: 0.82rem;
    padding: 8px 0;
}

/* ── Login spinner ──────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}
.spin { animation: spin 0.7s linear infinite; display: inline-block; }



/* Telegram Inline Keyboard Styles */
.inline-keyboard {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 15px;
}

.tg-inline-btn {
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(255, 0, 51, 0.5);
    color: var(--text-primary);
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
    flex: 1 1 calc(50% - 10px);
    text-align: center;
}

.tg-inline-btn:hover {
    background: rgba(255, 0, 51, 0.2);
    box-shadow: 0 0 10px rgba(255, 0, 51, 0.3);
}


.tg-inline-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: transparent;
}

/* ── Login Search ─────────────────────────────────── */

/* Limit picker block */
.login-limit-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
}

.login-limit-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    color: var(--text-secondary);
}

.login-limit-header i {
    color: var(--brand-red);
    font-size: 1.1rem;
}

.login-limit-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.login-limit-btn {
    background: rgba(255,0,51,0.08);
    border: 1px solid rgba(255,0,51,0.35);
    color: var(--text-primary);
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.18s;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.5px;
}

.login-limit-btn:hover {
    background: var(--brand-red);
    color: #fff;
    box-shadow: 0 0 12px rgba(255,0,51,0.3);
    transform: translateY(-1px);
}

/* Results header */
.login-results-header {
    padding-bottom: 10px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,0,51,0.15);
}

.login-results-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.login-results-query {
    font-size: 0.88rem;
    color: var(--text-primary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.login-results-query i { color: var(--brand-red); }

.login-results-count {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.04);
    padding: 3px 9px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.06);
}

/* Table wrapper — scrollable */
.login-table-wrap {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    max-height: 420px;
    overflow-y: auto;
}

.login-table-wrap::-webkit-scrollbar { width: 4px; height: 4px; }
.login-table-wrap::-webkit-scrollbar-track { background: transparent; }
.login-table-wrap::-webkit-scrollbar-thumb { background: rgba(255,0,51,0.3); border-radius: 4px; }

.login-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    table-layout: auto;
}

.login-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #0a0a0a;
}

.login-table th {
    padding: 9px 10px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--brand-red);
    border-bottom: 1px solid rgba(255,0,51,0.2);
    white-space: nowrap;
}

.login-row {
    animation: fadeIn 0.2s ease both;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.login-row:hover { background: rgba(255,255,255,0.03); }

.login-cell {
    padding: 7px 10px;
    vertical-align: middle;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.login-cell.site {
    color: var(--text-secondary);
    font-size: 0.78rem;
    max-width: 180px;
}

.login-cell.user {
    color: var(--text-primary);
    font-weight: 500;
    max-width: 200px;
}

.login-cell.pass {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
    min-width: 130px;
}

/* Password blur/reveal */
.pass-blur {
    font-family: monospace;
    font-size: 0.82rem;
    filter: blur(4px);
    user-select: none;
    transition: filter 0.2s;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pass-blur.revealed {
    filter: none;
    user-select: text;
}

.pass-toggle,
.copy-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 3px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.pass-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }
.copy-btn:hover    { color: var(--brand-red); background: rgba(255,0,51,0.1); }


/* ══ Sidebar Admin Panel (SAP) ══════════════════════════ */
.sidebar-admin-panel {
    border-top: 1px solid rgba(255,0,51,0.15);
    background: rgba(0,0,0,0.25);
    flex-shrink: 0;
    overflow: hidden;
}

.sap-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.sap-header:hover { background: rgba(255,0,51,0.06); }

.sap-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--brand-red);
}

.sap-title i { font-size: 1rem; }

.sap-caret {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: transform 0.25s ease;
}

/* Collapsible body */
.sap-body {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease;
    padding: 0 14px;
}

.sap-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-top: 12px;
}

.sap-label:first-child { margin-top: 0; }

/* Form */
.sap-form {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding-bottom: 4px;
}

.sap-input {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 8px 11px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}

.sap-input:focus {
    border-color: rgba(255,0,51,0.4);
    background: rgba(255,255,255,0.06);
}

.sap-role-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sap-role-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.sap-select {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.sap-select:focus { border-color: rgba(255,0,51,0.4); }

.sap-create-btn {
    background: var(--brand-red);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: 0.18s;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.sap-create-btn:hover {
    background: #cc0028;
    box-shadow: 0 0 12px rgba(255,0,51,0.35);
}

.sap-msg {
    font-size: 0.8rem;
    margin-top: 4px;
    padding: 6px 0;
    font-style: italic;
}

/* Users list */
.sap-users-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 12px;
    max-height: 130px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,0,51,0.2) transparent;
}

.sap-user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: border-color 0.15s;
}

.sap-user-item:hover { border-color: rgba(255,0,51,0.25); }

.sap-user-info {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--text-primary);
}

.sap-user-role {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.sap-user-role.admin {
    background: rgba(255,0,51,0.15);
    color: var(--brand-red);
}

.sap-user-role.user {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
}

.sap-users-loading {
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 6px 0;
}

/* User info bar — left side */
.user-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

/* ── Chat empty placeholder ───────────────────────── */
.chat-empty-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex: 1;
    height: 100%;
    min-height: 300px;
    text-align: center;
    padding: 40px 30px;
    animation: fadeIn 0.4s ease forwards;
    pointer-events: none;
    user-select: none;
}

.chat-empty-placeholder i {
    font-size: 3rem;
    color: rgba(255, 0, 51, 0.2);
}

.chat-empty-placeholder p {
    font-size: 0.9rem;
    color: rgba(170, 170, 170, 0.5);
    max-width: 340px;
    line-height: 1.6;
    font-style: italic;
}

/* ══ History Section ═════════════════════════════════ */
.history-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-dark);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255,0,51,0.1);
    background: rgba(10,10,10,0.8);
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 1.2rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i { color: var(--brand-red); }

/* Clear history button */
.clear-history-btn {
    display: flex;
    align-items: center;
    gap: 7px;
    background: transparent;
    border: 1px solid rgba(255,0,51,0.35);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 7px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: 'Inter', sans-serif;
}

.clear-history-btn i { font-size: 1rem; }

.clear-history-btn:hover {
    background: rgba(255,0,51,0.12);
    border-color: var(--brand-red);
    color: var(--brand-red);
    box-shadow: 0 0 10px rgba(255,0,51,0.15);
}

.clear-history-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* History list */
.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 24px 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.history-empty {
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
    margin-top: 20px;
}

.history-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.history-empty-state i {
    font-size: 2.5rem;
    color: var(--brand-red);
    opacity: 0.4;
}

.history-empty-state p {
    font-size: 0.9rem;
    font-style: italic;
}

.history-card {
    background: var(--bg-panel);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.15s;
    animation: fadeIn 0.3s ease forwards;
}

.history-card:hover { border-color: rgba(255,0,51,0.2); }

.history-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-secondary);
    gap: 10px;
    flex-wrap: wrap;
}

.history-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-meta i { color: var(--brand-red); font-size: 0.85rem; }

.history-query {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    border-left: 2px solid rgba(255,0,51,0.3);
    padding-left: 10px;
}

.history-response {
    font-size: 0.87rem;
    color: var(--text-primary);
    white-space: pre-wrap;
    line-height: 1.6;
    max-height: 160px;
    overflow-y: auto;
    scrollbar-width: thin;
}

