@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --surface: #FFFFFF;
    --background: #F3F4F6;
    --border: #E5E7EB;
    --text-main: #111827;
    --text-muted: #6B7280;
    --danger: #EF4444;
}

body.dark-mode {
    --surface: #1e1e1e;
    --background: #121212;
    --border: #333333;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
}

/* AUTH PAGES */
.auth-container {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0a0a0a;
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

/* Background elements like landing */
.auth-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.auth-orb {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    z-index: 1;
    animation: authOrbFloat 20s infinite alternate;
}

.auth-orb-1 {
    background: #4F46E5;
    top: -100px;
    right: -100px;
}

.auth-orb-2 {
    background: #8B5CF6;
    bottom: -100px;
    left: -100px;
    animation-delay: -10s;
}

@keyframes authOrbFloat {
    0% {
        transform: translate(0, 0);
    }

    100% {
        transform: translate(100px, 100px);
    }
}

.auth-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0);
    background-size: 40px 40px;
    z-index: 2;
}

.auth-card {
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    position: relative;
    color: white;
    margin-top: 50px;
}

.auth-card h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: white;
    letter-spacing: -0.02em;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    text-align: left;
}

.auth-form label {
    font-weight: 600;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    display: block;
}

.auth-form input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}

.auth-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.secondary-link {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: all 0.2s;
}

.secondary-link:hover {
    color: var(--primary);
}

.back-home {
    position: absolute;
    top: 2rem;
    left: 2rem;
    z-index: 100;
}

.btn-primary {
    background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
    color: white;
    font-weight: 700;
    padding: 0.85rem 1.75rem;
    border-radius: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
    font-family: inherit;
    font-size: 1rem;
    gap: 0.5rem;
    box-sizing: border-box;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 25px -5px rgba(79, 70, 229, 0.4);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-outline {
    background-color: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    font-weight: 500;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-outline:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

/* SIDEBAR LAYOUT */
.sidebar {
    width: 280px;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 1.5rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.1);
    border-radius: 12px;
    margin-top: 0.5rem;
    transition: all 0.2s ease;
}

.sidebar-user:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: rgba(79, 70, 229, 0.2);
}

body.dark-mode .sidebar-user {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .sidebar-user:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Plan Specific Highlights */
.sidebar-user.plan-pro {
    border: 2px solid rgba(139, 92, 246, 0.6);
    background: rgba(139, 92, 246, 0.1);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.25);
}

.sidebar-user.plan-pro .avatar {
    background: linear-gradient(135deg, #6D28D9, #8B5CF6);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-user.plan-enterprise {
    border: 2px solid rgba(245, 158, 11, 0.7);
    background: rgba(245, 158, 11, 0.12);
    box-shadow: 0 4px 25px rgba(245, 158, 11, 0.3);
}

.sidebar-user.plan-enterprise .avatar {
    background: linear-gradient(135deg, #D97706, #F59E0B);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.sidebar-user.plan-enterprise .plan {
    color: #FBBF24 !important;
    /* Brighter gold */
    font-weight: 800;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.sidebar-user.plan-pro .plan {
    color: #C4B5FD !important;
    /* Brighter purple */
    font-weight: 800;
    text-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}



.sidebar-user .avatar {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

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

.sidebar-user .name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .plan {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-links {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.75rem;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
    background-color: var(--background);
    color: var(--primary);
}

.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border);
}

.utility-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.utility-btn {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-main);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-sizing: border-box;
}

.utility-btn:hover {
    background: var(--background);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.utility-btn svg {
    width: 18px;
    height: 18px;
}

.utility-btn.logout-utility:hover {
    background: rgba(239, 68, 68, 0.08);
    border-color: #ef4444;
    color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

body.dark-mode .utility-btn {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .utility-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary);
}

/* Empty State */
.empty-state-card {
    grid-column: 1/-1;
    text-align: center;
    padding: 4rem;
    background: var(--surface);
    border-radius: 1.5rem;
    border: 2px dashed var(--border);
    transition: all 0.3s ease;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 2rem 1.5rem;
    box-sizing: border-box;
    max-width: 100%;
}

@media (min-width: 1025px) {
    .main-content {
        margin-left: 280px;
        padding: 3rem 4rem;
        max-width: 1400px;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-header h2 {
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* GRID & CARDS */
.agent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.agent-card {
    background-color: var(--surface);
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.agent-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-color: #d1d5db;
}

.agent-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.agent-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1.5rem;
}

.agent-card-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.125rem;
}

.agent-card-info p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.agent-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* FORMS */
.saas-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* CODE BLOCK */
.code-snippet {
    background: #111827;
    color: #e5e7eb;
    padding: 1.5rem;
    border-radius: 0.75rem;
    font-family: monospace;
    font-size: 0.875rem;
    position: relative;
    overflow-x: auto;
    margin-top: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.code-snippet pre {
    margin: 0;
    white-space: pre;
    width: 100%;
}

.code-snippet code {
    display: block;
    width: 100%;
}

/* Dark Mode Overrides */
body.dark-mode .auth-card {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .agent-card:hover {
    border-color: #555;
}

body.dark-mode .nav-item:hover,
body.dark-mode .nav-item.active {
    background-color: #2d2d2d;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select,
body.dark-mode .form-group textarea {
    background-color: #1e1e1e;
    color: #f3f4f6;
}

body.dark-mode .btn-outline {
    color: #f3f4f6;
}

body.dark-mode .btn-outline:hover {
    background-color: #333;
    border-color: #555;
}

/* ═══════════════════════════════════════════════════════
   CARD ACTION LINKS (Dashboard)
   ═══════════════════════════════════════════════════════ */
.card-action-link {
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.2s;
}

.card-action-link:hover {
    color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   STATS BAR
   ═══════════════════════════════════════════════════════ */
.logs-stats {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════════
   LOGS TABLE
   ═══════════════════════════════════════════════════════ */
.logs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.logs-table thead th {
    background: var(--background);
    padding: 0.875rem 1.25rem;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.logs-table tbody tr {
    transition: background-color 0.15s;
}

.logs-table tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.04);
}

.logs-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.015);
}

body.dark-mode .logs-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02);
}

body.dark-mode .logs-table tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.08);
}

.logs-table td {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.log-date {
    font-weight: 500;
    display: block;
}

.log-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.log-preview {
    color: var(--text-muted);
    font-size: 0.85rem;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ip-badge {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.msg-count-badge {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.log-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}

/* Password Strength Indicators */
.password-requirements {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.requirement-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--background);
    padding: 0.4rem 0.6rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.requirement-item.valid {
    color: #059669;
    background: #ecfdf5;
    border-color: #10b981;
}

.requirement-item.valid i {
    color: #10b981;
}

.requirement-item i {
    font-size: 0.6rem;
}

/* ═══════════════════════════════════════════════════════
   BUTTONS SMALL
   ═══════════════════════════════════════════════════════ */
.btn-small {
    padding: 0.35rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: inherit;
}

.btn-view {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    border-color: rgba(79, 70, 229, 0.2);
}

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

.btn-delete {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-delete:hover {
    background: #EF4444;
    color: white;
    border-color: #EF4444;
}

/* ═══════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.page-link {
    padding: 0.5rem 0.85rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.2s;
    background: var(--surface);
}

.page-link:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════ */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 1rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════
   CHAT REPLAY (Conversation Detail)
   ═══════════════════════════════════════════════════════ */
.chat-replay-container {
    max-width: 800px;
}

.chat-replay {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.replay-msg {
    display: flex;
    flex-direction: column;
    max-width: 75%;
}

.replay-msg.replay-user {
    align-self: flex-end;
    align-items: flex-end;
}

.replay-msg.replay-assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.replay-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.replay-user .replay-bubble {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.replay-assistant .replay-bubble {
    background: var(--background);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.replay-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.replay-bubble p {
    margin: 0;
}

/* ═══════════════════════════════════════════════════════
   THEME TOGGLE (Dashboard)
   ═══════════════════════════════════════════════════════ */
.theme-toggle-dashboard {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.theme-toggle-dashboard:hover {
    background: rgba(79, 70, 229, 0.08);
    border-color: var(--primary);
    color: var(--primary);
}

body.dark-mode .theme-toggle-dashboard:hover {
    background: rgba(79, 70, 229, 0.15);
}

/* NAV ITEM SVG */
.nav-item svg {
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.nav-item:hover svg,
.nav-item.active svg {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE (Mobile)
   ═══════════════════════════════════════════════════════ */

/* Mobile Header (Hidden by default) */
.mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 90;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
}

.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    position: relative;
}

.table-responsive table {
    width: 100% !important;
    min-width: 900px !important;
    /* Force internal scroll */
}

/* ═══════════════════════════════════════════════════════
   EDIT AGENT PAGE & PANELS
   ═══════════════════════════════════════════════════════ */
.edit-agent-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    align-items: start;
}

.collapsible-trigger {
    display: none;
    /* Only visible on mobile */
    width: 100%;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-main);
}

@media (max-width: 1024px) {
    body {
        display: block !important;
        overflow-x: hidden;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 5rem 1rem 2rem !important;
        width: 100% !important;
        max-width: 100vw !important;
    }

    .sidebar {
        left: -100%;
        width: 280px;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.1);
        z-index: 1000;
    }

    body.sidebar-open {
        overflow: hidden;
        /* Prevent scrolling background */
    }

    body.sidebar-open .sidebar {
        left: 0;
    }

    body.sidebar-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 95;
    }

    .mobile-header {
        display: flex;
    }

    .edit-agent-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        min-width: 0;
    }

    .collapsible-trigger {
        display: flex;
    }

    .collapsible-content {
        display: none;
    }

    .collapsible-content.open {
        display: block;
    }

    .form-grid-2,
    .form-grid-3 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    #sidebar-close {
        display: block !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h2 {
        font-size: 1.5rem;
    }

    .agent-grid {
        grid-template-columns: 1fr;
    }

    .logs-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stat-card {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .saas-box {
        padding: 1.5rem;
    }
}

/* -------------------------------------------------------
   SETTINGS & USAGE
   ------------------------------------------------------- */

.settings-header {
    margin-bottom: 2.5rem;
}

.settings-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.settings-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 2rem;
}

@media (max-width: 992px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

.settings-col {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
}

.section-title i {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

.read-only-input {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 500;
}

.settings-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text-main);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.settings-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: 1rem;
    margin-bottom: 1.5rem;
    background: rgba(139, 92, 246, 0.03);
}

.toggle-switch {
    width: 44px;
    height: 24px;
    background: #333;
    border-radius: 20px;
    position: relative;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-slider {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    left: 23px;
}

/* Usage Card */
.usage-main-card {
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.usage-glow {
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: var(--primary);
    filter: blur(80px);
    opacity: 0.15;
    z-index: 0;
}

.plan-badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(139, 92, 246, 0.15);
    color: #A78BFA;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.usage-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .usage-stats-grid {
        grid-template-columns: 1fr;
    }
}

.stat-box {
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 1rem;
    border: 1px solid var(--border);
}

.stat-box-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-box-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Progress Bar */
.progress-container {
    height: 12px;
    width: 100%;
    background: #1a1a1a;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid #333;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6D28D9, #8B5CF6);
    border-radius: 20px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

/* Actions */
.settings-action-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.settings-action-btn.primary {
    background: linear-gradient(135deg, #6D28D9, #8B5CF6);
    color: white;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.2);
}

.settings-action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
    opacity: 0.95;
}

.settings-action-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.settings-action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
    transform: translateY(-2px);
}

/* Alert Message */
.alert-box {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-box.success {
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-box.error {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}


/* -------------------------------------------------------
   MODALS (PREMIUM REUSABLE)
   ------------------------------------------------------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    background: var(--surface);
    width: 100%;
    max-width: 400px;
    border-radius: 1.25rem;
    padding: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
    text-align: center;
}

.modal-icon-warning {
    width: 64px;
    height: 64px;
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.modal-icon-warning svg {
    width: 32px;
    height: 32px;
}

.modal-header h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    font-weight: 700;
}

.modal-header p {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

.modal-btn-cancel {
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-btn-cancel:hover {
    background: var(--background);
}

.modal-btn-confirm {
    padding: 0.75rem;
    border-radius: 10px;
    border: none;
    background: #EF4444;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.modal-btn-confirm:hover {
    background: #DC2626;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(239, 68, 68, 0.3);
}

/* -------------------------------------------------------
   UTILITIES
   ------------------------------------------------------- */

.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, #10B981, #059669);
    color: white;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(16, 185, 129, 0.4);
}

.agent-name-badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}


/* -------------------------------------------------------
   AUTH PAGES (BASE AUTH)
   ------------------------------------------------------- */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

.auth-card {
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    padding: 3rem;
    width: 100%;
    max-width: 450px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: white;
    letter-spacing: -0.02em;
}

.auth-card p {
    line-height: 1.6;
}

.auth-logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.auth-logo-img {
    height: 44px;
    width: 44px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.4);
}

.auth-brand-name {
    font-weight: 800;
    font-size: 1.75rem;
    letter-spacing: -0.02em;
    color: white;
}

.back-home-container {
    position: absolute;
    top: 2rem;
    left: 2rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    z-index: 10;
}

.auth-form {
    text-align: left;
}

.auth-form .form-group {
    margin-bottom: 1.5rem;
}

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    color: rgba(255, 255, 255, 0.8);
}

.auth-form input {
    width: 100%;
    padding: 0.9rem 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem;
    color: white;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.auth-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.secondary-link {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: color 0.2s;
}

.secondary-link:hover {
    color: var(--primary);
}


/* -------------------------------------------------------
   LAYOUT & DASHBOARD BASE
   ------------------------------------------------------- */

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    height: 64px;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-logo-wrap {
    background: white;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mobile-logo-img {
    height: 24px;
    width: 24px;
    object-fit: contain;
}

.mobile-brand-name {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #FFF, #A78BFA);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.mobile-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-logo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-logo-img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 6px;
}

.sidebar-footer-links {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    justify-content: center;
}

.sidebar-footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-footer-links a:hover {
    color: var(--primary);
}

@media (max-width: 992px) {
    .mobile-header {
        display: flex;
    }
}

/* DataTables Custom Styles */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-muted) !important;
    font-size: 0.85rem;
    margin: 1rem;
}

.dataTables_wrapper .dataTables_filter input {
    background: var(--background) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    color: var(--text-main) !important;
    padding: 6px 12px !important;
}

table.dataTable {
    border-collapse: collapse !important;
    border-bottom: none !important;
}

table.dataTable thead th {
    border-bottom: 2px solid var(--border) !important;
    background: var(--background) !important;
}

table.dataTable td {
    border-bottom: 1px solid var(--border) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary-hover) !important;
    color: white !important;
    border: none !important;
}

body.dark-mode .dataTables_wrapper .dataTables_length select,
body.dark-mode .dataTables_wrapper .dataTables_filter input {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: white !important;
}


/* 2FA Special Styles */
.auth-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
    margin-top: -1rem;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.auth-2fa-container {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-2fa-input {
    width: 100% !important;
    letter-spacing: 0.6em !important;
    text-align: center !important;
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    padding: 1.25rem !important;
    border: 2px solid var(--border) !important;
    border-radius: 1rem !important;
    background: rgba(255, 255, 255, 0.03) !important;
    color: white !important;
    font-family: " Courier New\, Courier, monospace !important;

}

@media (max-width: 1024px) {
    .mobile-header {
        display: flex !important;
    }

    .sidebar {
        left: -100% !important;
    }

    body.sidebar-open .sidebar {
        left: 0 !important;
    }
}

.auth-2fa-input:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

.auth-footer-text {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.875rem;
}


/* -------------------------------------------------------
   LEGAL PAGES (TERMS & PRIVACY)
   ------------------------------------------------------- */

.legal-page {
    background: var(--background);
    color: var(--text-main);
    line-height: 1.7;
}

.legal-container {
    max-width: 850px;
    margin: 4rem auto;
    padding: 3rem;
    background: var(--surface);
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.legal-container h1 {
    font-size: 2.75rem;
    font-weight: 850;
    margin-bottom: 1rem;
    color: white;
    letter-spacing: -0.03em;
}

.legal-date {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 3rem;
    display: block;
}

.legal-container h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legal-container section {
    margin-bottom: 2.5rem;
}

.legal-container p,
.legal-container li {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.25rem;
}

.legal-container ul {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}

.legal-container li {
    margin-bottom: 0.75rem;
}

.legal-warning {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    padding: 1.25rem;
    border-radius: 0.5rem;
    color: #f87171 !important;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 2.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.back-link:hover {
    transform: translateX(-5px);
    color: var(--primary-hover);
}