:root {
    --primary: #10b981; /* Emerald Green Accent */
    --primary-dark: #059669;
    --navy: #0f172a; /* Deep Navy Blue */
    --navy-light: #1e293b;
    --secondary: #6366f1;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    --bg-main: #ffffff; /* Crisp White Background */
    --bg-sidebar: #0f172a; /* Navy Sidebar */
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --border: #e2e8f0;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
    --glass: rgba(255, 255, 255, 0.8);
    --sidebar-width: 280px;
    --font: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font);
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
}

/* ── Login Overlay ── */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #ffffff;
    z-index: 1000;
    display: flex;
}

.login-left {
    flex: 1.2;
    background: linear-gradient(135deg, #4f46e5 0%, #0b1120 100%);
    padding: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    color: white;
}

.login-left h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 24px;
}

.login-left p {
    font-size: 18px;
    opacity: 0.8;
    margin-bottom: 48px;
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.form-group { margin-bottom: 24px; }
.form-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    transition: border 0.2s;
}
.form-control:focus { border-color: var(--primary); outline: none; }

.btn {
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }

/* ── App Layout ── */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar) !important;
    color: white !important;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 24px 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

.logo {
    padding: 0 24px 32px;
    font-size: 24px;
    font-weight: 800;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.nav-item i {
    font-size: 20px;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.user-profile {
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

/* ── Main Content ── */
.main-content {
    flex: 1;
    margin-left: 260px;
}

.top-header {
    height: 80px;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
}

.top-header h1 { font-size: 22px; font-weight: 700; }

.header-actions { display: flex; align-items: center; gap: 20px; }
.status-indicator { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.connected { background: var(--primary); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.dot.disconnected { background: #ef4444; }

/* ── Content Area ── */
.content-area { padding: 40px; }

.page-section { display: none; }
.page-section.active { display: block; }

/* ── Cards & Grid ── */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: white;
    padding: 24px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: var(--navy);
    color: white;
}
.stat-icon.green { color: #10b981; background: #f0fdf4; }
.stat-icon.purple { color: #8b5cf6; background: #f5f3ff; }

.stat-details h3 { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; }

.card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 24px;
}

.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.card-header h2 { font-size: 18px; font-weight: 700; }

/* ── Tables ── */
.table-container { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 12px; font-size: 12px; color: var(--text-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); }
.data-table td { padding: 16px 12px; font-size: 14px; border-bottom: 1px solid #f8fafc; }

/* ── Logs ── */
.log-container {
    background: #0b1120;
    color: #94a3b8;
    padding: 20px;
    border-radius: 12px;
    font-family: monospace;
    font-size: 13px;
    max-height: 300px;
    overflow-y: auto;
}
.log-entry { margin-bottom: 8px; }
.log-entry.system { color: var(--primary); }



/* Drawflow Customizations */
.drag-drawflow {
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: #f8fafc;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.drag-drawflow:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #eef2ff;
}

.drag-drawflow i {
    font-size: 18px;
    color: var(--primary);
}

.drawflow {
    background: #f8fafc;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
}

.drawflow .drawflow-node {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 0;
    width: 250px;
}

.drawflow .drawflow-node .title-box {
    padding: 12px 16px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawflow .drawflow-node .box {
    padding: 16px;
}

.drawflow .drawflow-node input, .drawflow .drawflow-node select {
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-top: 8px;
    font-family: inherit;
    font-size: 13px;
}

.drawflow .drawflow-node .btn-add-option {
    margin-top: 8px;
    width: 100%;
    padding: 6px;
    font-size: 12px;
}

.drawflow .connection .main-path {
    stroke: var(--primary);
    stroke-width: 3px;
}
