:root {
    --bg-dark: #0f172a;
    --bg-panel: #1e293b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --accent: #10b981;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass: rgba(30, 41, 59, 0.7);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 14px;
    /* Slightly smaller base for dashboard density */
    overflow: hidden;
    /* App-like feel */
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 600;
}

/* Utilities */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

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

.card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
}

.p-4 {
    padding: 1.5rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

/* Auth Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.auth-overlay.hidden {
    display: none;
}

.auth-card {
    background: var(--bg-panel);
    padding: 3rem;
    border-radius: 1rem;
    border: 1px solid var(--border);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.auth-card h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.input-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: white;
    padding: 0.75rem;
    border-radius: 0.5rem;
    outline: none;
}

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

.error-msg {
    color: #f87171;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.2em;
}


/* Layout */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-heading);
}

.brand span {
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--font-heading);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

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

.nav-item:hover,
.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.nav-item svg {
    stroke-width: 2px;
}

.user-profile {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.token-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.indicator {
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.logout-btn:hover {
    color: #f87171;
}


/* Main Content */
.content-area {
    padding: 2rem;
    overflow-y: auto;
    background: linear-gradient(to bottom right, #0f172a, #1e1b4b);
}

.view {
    display: none;
    animation: fadeIn 0.3s ease;
}

.view.active {
    display: block;
}

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

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

.view-header {
    margin-bottom: 2rem;
}

.view-header h2 {
    font-size: 1.75rem;
    color: white;
    margin-bottom: 0.25rem;
}

.view-header p {
    color: var(--text-muted);
}

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1rem;
    backdrop-filter: blur(10px);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    font-family: var(--font-heading);
}

.stat-value.highlight {
    color: var(--accent);
    font-size: 1.25rem;
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.chart-card {
    background: var(--glass);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1rem;
    min-height: 300px;
}

/* Search & Filters */
.search-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
    background: var(--glass);
    backdrop-filter: blur(10px);
}

.search-main {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
    position: relative;
}

.search-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

.search-main input {
    flex: 1;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.filter-group input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    padding: 0.625rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9rem;
}

.search-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

#results-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

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

.table-container {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 1rem;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
}

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

tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.tag {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent);
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.75rem;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.list-card {
    padding: 1.5rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.list-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
}

.industries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.industry-card {
    padding: 1.5rem;
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.industry-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
}

.industry-card h3 {
    font-size: 1.1rem;
    color: white;
    margin-bottom: 0.5rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.3s;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    transition: transform 0.3s;
}

.modal-overlay.hidden .modal-card {
    transform: scale(0.95);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.25rem;
    color: white;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}

.modal-close-btn:hover {
    color: white;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    color: var(--text-main);
}

.modal-detail-row {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.modal-detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    width: 140px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    color: white;
    word-break: break-word;
}

.loader {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

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

/* Import Styles */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 1rem;
    padding: 3rem;
    text-align: center;
    transition: all 0.2s;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.1);
}

.upload-area:hover,
.upload-area.dragging {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    color: var(--text-muted);
}

.upload-label svg {
    color: var(--primary);
    opacity: 0.7;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2.5rem;
}

.p-3 {
    padding: 1rem;
}

.rounded {
    border-radius: 0.5rem;
}

/* Dashboard Insights */
.mt-6 {
    margin-top: 1.5rem;
}

.full-width {
    grid-column: 1 / -1;
}

.dashboard-stat-item {
    margin-bottom: 1.25rem;
}

.stat-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.stat-name {
    color: var(--text-muted);
    font-weight: 500;
}

.stat-count {
    color: white;
    font-weight: 600;
}

.stat-bar-bg {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #818cf8);
    border-radius: 4px;
    transition: width 1s ease-out;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

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

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.rounded-lg {
    border-radius: 0.75rem;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-3 {
    gap: 0.75rem;
}

/* A2A Agent Chat */
.bg-darker {
    background: rgba(0, 0, 0, 0.3);
}

.loader-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.loader-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: dots 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loader-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dots {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

#view-agent table {
    font-size: 0.85rem;
}