/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --success: #48bb78;
    --danger: #f56565;
    --warning: #ed8936;
    --info: #4299e1;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
}

/* App Container */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--radius);
    margin-bottom: 0.25rem;
    transition: all 0.2s;
    font-weight: 500;
}

.sidebar-nav a:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: var(--white);
}

.sidebar-nav .icon {
    font-size: 1.25rem;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
}

.user-details {
    flex: 1;
    min-width: 0;
}

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

.user-email {
    font-size: 0.75rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: var(--gray-100);
    color: var(--gray-700);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: var(--gray-200);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

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

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: 0.25rem;
}

.page-header p {
    color: var(--gray-600);
    font-size: 1rem;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
}

/* Buttons */
button {
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    border-radius: var(--radius);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--gray-300);
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background: var(--gray-50);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--gray-100) 100%);
    padding: 2rem;
}

.auth-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 3rem;
    width: 100%;
    max-width: 440px;
}

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

.auth-header .logo {
    justify-content: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 1.875rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--gray-600);
}

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--gray-600);
    font-size: 0.875rem;
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error {
    padding: 0.75rem;
    background: #fee;
    color: var(--danger);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

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

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

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

.dashboard-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.dashboard-card h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--gray-900);
}

/* Charts */
.chart-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chart-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chart-label {
    min-width: 100px;
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

.chart-value {
    flex: 1;
    position: relative;
    height: 32px;
    background: var(--gray-100);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    align-items: center;
}

.chart-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.chart-value span {
    position: absolute;
    left: 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--gray-700);
    z-index: 1;
}

/* Contacts List */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: var(--radius);
    transition: all 0.2s;
}

.contact-item:hover {
    background: var(--gray-100);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
    flex-shrink: 0;
}

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

.contact-name {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.125rem;
}

.contact-email {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.contact-company {
    font-size: 0.8125rem;
    color: var(--gray-600);
}

.contact-strength {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strength-bar {
    width: 100px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.strength-bar-small {
    width: 60px;
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

.strength-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strength-indicator span {
    font-size: 0.75rem;
    color: var(--gray-600);
    font-weight: 600;
}

/* Table */
.table {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    transition: all 0.2s;
    cursor: pointer;
}

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

.table-row:hover {
    background: var(--gray-50);
}

.table-cell {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.contact-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.contact-cell .contact-avatar {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
}

.contact-cell .contact-name {
    font-size: 0.875rem;
}

.contact-cell .contact-email {
    font-size: 0.75rem;
}

/* Kanban Board */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.kanban-column {
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    min-width: 260px;
    display: flex;
    flex-direction: column;
}

.kanban-header {
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.kanban-header h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.kanban-stats {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-600);
}

.kanban-body {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 400px;
}

.deal-card {
    background: white;
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
    cursor: grab;
    transition: all 0.2s;
}

.deal-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.deal-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.deal-title {
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 0.5rem;
}

.deal-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.deal-company {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.deal-value {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--success);
}

.deal-contact {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.empty-column {
    padding: 2rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* Insights */
.insights-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.insights-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-description {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

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

.insight-body {
    margin-bottom: 1rem;
}

.insight-body p {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.insight-footer {
    display: flex;
    gap: 0.5rem;
}

/* Network */
.network-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.network-node {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: white;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.network-node:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.node-name {
    font-weight: 700;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.node-company {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.node-strength {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.network-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.network-stats .stat-card {
    flex-direction: column;
    text-align: center;
}

.network-stats h3 {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.network-stats .stat-value {
    font-size: 2.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

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

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.modal-close:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.modal form {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Utility */
.loading {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 1rem;
}

.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid,
    .insights-grid {
        grid-template-columns: 1fr;
    }

    .kanban-board {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0.5rem;
    }

    .sidebar-nav a {
        white-space: nowrap;
    }

    .main-content {
        padding: 1rem;
    }

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

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

    .kanban-board {
        grid-template-columns: 1fr;
    }

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

    .table-header,
    .table-row {
        grid-template-columns: 1fr;
    }

    .table-cell:not(:first-child) {
        display: none;
    }
}

/* ============================================================
   MLB4 brand — dark admin shell
   Appended override. Keeps the component CSS above intact and
   re-skins it by redefining the design tokens.
   ============================================================ */

:root {
    --primary:    #C9F24D;
    --primary-dark: #B4DD3A;
    --secondary:  #A5E23C;
    --success:    #7BD88F;
    --danger:     #FF8A8A;
    --warning:    #F0B45E;
    --info:       #7C9CFF;

    /* inverted scale: 50 = page canvas, 900 = primary text */
    --gray-50:  #08090B;
    --gray-100: #0D0F13;
    --gray-200: rgba(255,255,255,0.085);
    --gray-300: rgba(255,255,255,0.16);
    --gray-400: #6E747E;
    --gray-500: #8B9099;
    --gray-600: #A8ADB6;
    --gray-700: #C3C8D0;
    --gray-800: #DCDEE2;
    --gray-900: #EDEEF0;

    --white:    #101318;   /* card / panel surface */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow:    0 1px 3px 0 rgb(0 0 0 / 0.5);
    --shadow-lg: 0 12px 28px -8px rgb(0 0 0 / 0.65);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
}

h1, h2, h3, h4, .logo {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    letter-spacing: -0.02em;
}

/* dark text on the lime gradient */
.sidebar-nav a.active,
.user-avatar,
.btn-primary,
.contact-avatar,
.network-node {
    color: #08090B;
}
.btn-primary { font-weight: 600; }
.btn-primary:hover { filter: brightness(1.06); }

.sidebar { background: var(--gray-100); }
.sidebar-nav a { color: var(--gray-600); }

/* form controls read as dark fields */
input, select, textarea {
    background: var(--gray-50);
    color: var(--gray-900);
    border-color: var(--gray-300);
}
input::placeholder, textarea::placeholder { color: var(--gray-400); }
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 242, 77, 0.14);
}
select option { background: var(--gray-100); color: var(--gray-900); }

.error {
    background: rgba(255, 138, 138, 0.12);
    border: 1px solid rgba(255, 138, 138, 0.35);
    color: var(--danger);
}

/* the logo mark in the sidebar */
.logo svg rect[fill^="url"] { fill: #C9F24D; }

/* Surfaces that hardcode the named colour `white` instead of the token.
   Listed explicitly rather than sed-replaced so the original rules stay intact. */
.auth-card,
.stat-card,
.dashboard-card,
.table,
.deal-card,
.insight-card,
.modal-content,
.contact-card,
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
}

.card-title,
.dashboard-card h3,
.stat-value,
.stat-label,
.table th,
.modal-content h2,
.modal-content h3 {
  color: var(--gray-900);
}
.stat-label,
.table th { color: var(--gray-500); }

.table tr { border-color: var(--gray-200); }
.table tbody tr:hover { background: var(--gray-100); }

.auth-container {
  background: radial-gradient(120% 120% at 50% 0%, rgba(201,242,77,0.07), transparent 60%), var(--gray-50);
}
