:root {
    --bg-primary: #0a0b0e;
    --bg-secondary: #11141a;
    --bg-card: rgba(22, 27, 34, 0.65);
    --bg-card-hover: rgba(30, 36, 46, 0.8);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(0, 230, 118, 0.15);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-green: #00e676;
    --accent-green-glow: rgba(0, 230, 118, 0.4);
    --accent-cyan: #00f2fe;
    --accent-cyan-glow: rgba(0, 242, 254, 0.4);
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-orange: #f59e0b;
    
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(0, 230, 118, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 242, 254, 0.04) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(17, 20, 26, 1) 0px, transparent 100%);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Layout Framework */
.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Navigation */
.sidebar {
    background: rgba(13, 16, 22, 0.95);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1.75rem 1.25rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.sidebar-header {
    align-items: center;
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    padding-left: 0.5rem;
}

.logo-icon {
    background: linear-gradient(135deg, var(--accent-green), var(--accent-cyan));
    border-radius: 10px;
    color: #000;
    display: grid;
    height: 40px;
    place-items: center;
    width: 40px;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.3);
}

.glow-icon {
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.nav-item {
    align-items: center;
    border-radius: 10px;
    color: var(--text-secondary);
    display: flex;
    gap: 0.85rem;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.85rem 1rem;
    text-decoration: none;
    transition: var(--transition-smooth);
    border: 1px solid transparent;
}

.nav-item svg {
    transition: var(--transition-smooth);
    opacity: 0.7;
}

.nav-item:hover, .nav-item.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
    background: linear-gradient(to right, rgba(0, 230, 118, 0.08), rgba(0, 242, 254, 0.02));
    border-left: 3px solid var(--accent-green);
    border-color: rgba(0, 230, 118, 0.15) rgba(0, 230, 118, 0.05) rgba(0, 230, 118, 0.05) rgba(0, 230, 118, 0.8);
    box-shadow: inset 5px 0 15px rgba(0, 230, 118, 0.03);
}

.nav-item.active svg {
    color: var(--accent-green);
    opacity: 1;
    filter: drop-shadow(0 0 5px var(--accent-green-glow));
}

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

.status-indicator {
    align-items: center;
    display: flex;
    gap: 0.65rem;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.dot {
    border-radius: 50%;
    display: inline-block;
    height: 8px;
    width: 8px;
    position: relative;
}

.dot.disconnected {
    background-color: var(--accent-red);
    box-shadow: 0 0 8px var(--accent-red);
}

.dot.connecting {
    background-color: var(--accent-orange);
    box-shadow: 0 0 8px var(--accent-orange);
    animation: pulse 1.5s infinite;
}

.dot.qr {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    animation: pulse 1.5s infinite;
}

.dot.connected {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
    animation: breathe 2s infinite ease-in-out;
}

.device-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-left: 0.9rem;
}

/* Main Workspace Area */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem 2.5rem;
}

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

.content-header h1 {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.quick-status-pill {
    background: rgba(0, 230, 118, 0.05);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    display: flex;
    gap: 0.35rem;
}

.quick-status-pill .label {
    color: var(--text-secondary);
}

.quick-status-pill .value.connected {
    color: var(--accent-green);
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.75rem;
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 35px 0 rgba(0, 0, 0, 0.25);
}

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

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
}

/* Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    align-items: center;
    background: rgba(22, 27, 34, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    transition: var(--transition-smooth);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-icon {
    border-radius: 12px;
    display: grid;
    height: 48px;
    place-items: center;
    width: 48px;
}

.stat-icon.rules {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
}

.stat-icon.workflows {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

.stat-icon.active-chats {
    background: rgba(0, 230, 118, 0.1);
    color: var(--accent-green);
}

.stat-data {
    display: flex;
    flex-direction: column;
}

.stat-data .number {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-data .label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Dashboard Core Grid */
.dashboard-core-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 1.5rem;
}

/* Connection Center QR */
.connection-card {
    display: flex;
    flex-direction: column;
}

.connection-status-tag {
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    text-transform: uppercase;
}

.connection-status-tag.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.connection-status-tag.connecting {
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-orange);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.connection-status-tag.qr {
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 242, 254, 0.2);
}

.connection-status-tag.connected {
    background: rgba(0, 230, 118, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.2);
}

.qr-container {
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    min-height: 270px;
    padding: 1.5rem;
    position: relative;
}

.qr-box {
    align-items: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.qr-placeholder {
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.qr-pulse-icon {
    opacity: 0.4;
    transition: var(--transition-smooth);
}

.qr-box.idle:hover .qr-pulse-icon {
    color: var(--accent-green);
    opacity: 0.8;
    filter: drop-shadow(0 0 10px var(--accent-green-glow));
}

.qr-image {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    height: 220px;
    padding: 10px;
    width: 220px;
    border: 4px solid var(--accent-cyan);
    animation: borderGlow 4s infinite alternate;
}

.qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top: 3px solid var(--accent-green);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.connection-instructions {
    color: var(--text-secondary);
}

.connection-instructions h4 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.connection-instructions ol {
    padding-left: 1.15rem;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Logged In User Frame */
.connected-user-panel {
    align-items: center;
    background: rgba(0, 230, 118, 0.03);
    border: 1px solid rgba(0, 230, 118, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem 1.5rem;
    text-align: center;
    width: 100%;
}

.user-avatar-glow {
    background: rgba(0, 230, 118, 0.08);
    border: 2px solid var(--accent-green);
    border-radius: 50%;
    color: var(--accent-green);
    display: grid;
    height: 70px;
    place-items: center;
    width: 70px;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.2);
    animation: float 3s infinite ease-in-out;
}

.user-details h4 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.user-details p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.badge {
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.75rem;
}

.badge-success {
    background: rgba(0, 230, 118, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(0, 230, 118, 0.3);
}

/* Checklist widget */
.overview-card {
    display: flex;
    flex-direction: column;
}

.checklist-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.checklist-item {
    display: flex;
    gap: 1rem;
    opacity: 0.6;
    transition: var(--transition-smooth);
}

.checklist-item.done {
    opacity: 1;
}

.check-icon {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-muted);
    display: grid;
    font-weight: 700;
    height: 32px;
    place-items: center;
    width: 32px;
    font-size: 0.85rem;
}

.checklist-item.done .check-icon {
    background: rgba(0, 230, 118, 0.1);
    border-color: rgba(0, 230, 118, 0.3);
    color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.1);
}

.check-content h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.check-content p {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Action Bars */
.panel-actions {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.panel-actions h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Premium Tables */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
}

.premium-table {
    border-collapse: collapse;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
}

.premium-table th {
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-weight: 600;
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.premium-table td {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

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

.premium-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-primary);
}

.table-row-keyword {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
}

.table-badge-match {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.2);
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: capitalize;
}

.text-truncate-cell {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-img-preview {
    border-radius: 6px;
    height: 36px;
    object-fit: cover;
    width: 36px;
    border: 1px solid var(--border-color);
}

.media-cell-td {
    min-width: 120px;
    vertical-align: middle;
}

.table-no-image {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Buttons System */
.btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.65rem 1.25rem;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-green), #00c853);
    color: #000;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.btn-danger:hover {
    background: var(--accent-red);
    color: #fff;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.btn-outline-danger:hover {
    background: rgba(239, 68, 68, 0.05);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-small {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    transition: var(--transition-smooth);
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-small.danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.btn-small.danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Action column elements */
.actions-cell {
    display: flex;
    gap: 0.5rem;
}

/* Toggle Switches */
.switch {
    display: inline-block;
    height: 22px;
    position: relative;
    width: 44px;
}

.switch input {
    height: 0;
    opacity: 0;
    width: 0;
}

.toggle-slider {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 34px;
    bottom: 0;
    cursor: pointer;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
    transition: .3s;
}

.toggle-slider:before {
    background-color: var(--text-secondary);
    border-radius: 50%;
    bottom: 2px;
    content: "";
    height: 16px;
    left: 3px;
    position: absolute;
    transition: .3s;
    width: 16px;
}

input:checked + .toggle-slider {
    background-color: rgba(0, 230, 118, 0.2);
    border-color: rgba(0, 230, 118, 0.4);
}

input:checked + .toggle-slider:before {
    background-color: var(--accent-green);
    transform: translateX(20px);
    box-shadow: 0 0 8px var(--accent-green-glow);
}

/* Workflow Configurator Layout */
.workflow-editor-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.node-selection-card {
    height: 520px;
    overflow-y: auto;
    padding: 1.25rem;
}

.node-selection-card h4 {
    font-family: var(--font-heading);
    margin-bottom: 1rem;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.node-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.node-item-button {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    text-align: left;
    transition: var(--transition-smooth);
    width: 100%;
}

.node-item-button:hover {
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.node-item-button.active {
    background: rgba(168, 85, 247, 0.06);
    border-color: rgba(168, 85, 247, 0.3);
    color: var(--text-primary);
}

.node-item-button .node-name {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.node-item-button .node-id {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.node-item-button.active .node-id {
    color: #c084fc;
}

.node-editor-card {
    display: flex;
    flex-direction: column;
}

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

.editor-header h4 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.editor-header .badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-family: monospace;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

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

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input, .form-group textarea, .form-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.65rem 0.85rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
    border-color: rgba(255, 255, 255, 0.25);
    outline: none;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.03);
}

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

.warning-text {
    color: var(--accent-orange);
}

.form-toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    border-radius: 10px;
}

.toggle-content h5 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.toggle-content p {
    color: var(--text-secondary);
    font-size: 0.75rem;
    max-width: 420px;
}

/* Node Option Grid Editor */
.options-container {
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

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

.options-header h5 {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
}

.options-list-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.node-editor-placeholder {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 520px;
    text-align: center;
    gap: 1.5rem;
}

.node-editor-placeholder svg {
    opacity: 0.2;
    animation: float 4s infinite ease-in-out;
}

.node-editor-placeholder p {
    max-width: 380px;
    font-size: 0.95rem;
}

.form-footer {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: 0.5rem;
}

/* Campaigns Tab Layout */
.campaigns-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    align-items: start;
}

/* Recipients Header with Counter */
.recipients-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.recipients-count-badge {
    background: rgba(0, 230, 118, 0.08);
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: 20px;
    color: var(--accent-green);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.65rem;
    font-family: var(--font-heading);
    animation: fadeIn 0.3s ease;
}

.recipients-count-num {
    font-weight: 700;
}

/* Excel Upload Section */
.excel-upload-section {
    margin-top: 0.5rem;
}

.excel-upload-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.divider-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    white-space: nowrap;
}

.excel-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.25rem 1rem;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-align: center;
}

.excel-dropzone:hover {
    border-color: rgba(0, 230, 118, 0.3);
    background: rgba(0, 230, 118, 0.02);
}

.excel-dropzone.drag-over {
    border-color: var(--accent-green);
    background: rgba(0, 230, 118, 0.05);
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.08);
}

.excel-dropzone-icon {
    color: var(--text-muted);
    opacity: 0.6;
    transition: var(--transition-smooth);
}

.excel-dropzone:hover .excel-dropzone-icon {
    color: var(--accent-green);
    opacity: 0.8;
}

.excel-dropzone p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.excel-dropzone p strong {
    color: var(--text-primary);
}

.excel-dropzone .upload-link {
    color: var(--accent-green);
    cursor: pointer;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.excel-dropzone .help-text {
    margin-top: 0;
}

/* Loaded File Preview */
.excel-file-loaded {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    background: rgba(0, 230, 118, 0.04);
    border: 1px solid rgba(0, 230, 118, 0.15);
    border-radius: 10px;
    animation: fadeIn 0.3s ease;
}

.excel-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.excel-file-icon {
    color: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(0, 230, 118, 0.08);
    border-radius: 8px;
}

.excel-file-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.excel-file-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.excel-file-stats {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 500;
}

/* Import Options */
.excel-import-options {
    margin-top: 0.5rem;
}

.excel-option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem 0;
}

.excel-option-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

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


.campaign-idle-state {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    gap: 1.5rem;
}

.campaign-idle-state svg {
    opacity: 0.2;
}

.campaign-idle-state p {
    max-width: 320px;
    font-size: 0.9rem;
}

.campaign-active-state {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem 0;
}

.campaign-status-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.campaign-indicator {
    background-color: var(--accent-green);
    border-radius: 50%;
    height: 12px;
    width: 12px;
    box-shadow: 0 0 10px var(--accent-green);
}

.campaign-indicator.pulsing {
    animation: pulse 1s infinite alternate;
}

.progress-bar-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
    height: 10px;
    overflow: hidden;
    width: 100%;
}

.progress-bar-fill {
    background: linear-gradient(to right, var(--accent-green), var(--accent-cyan));
    height: 100%;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--accent-green-glow);
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
}

.broadcast-stats {
    display: flex;
    gap: 1.25rem;
}

.stat-pill {
    align-items: center;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding: 1rem 0.5rem;
    border: 1px solid transparent;
}

.stat-pill.success {
    background: rgba(0, 230, 118, 0.03);
    border-color: rgba(0, 230, 118, 0.1);
}

.stat-pill.success .num {
    color: var(--accent-green);
    font-size: 1.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.stat-pill.danger {
    background: rgba(239, 68, 68, 0.03);
    border-color: rgba(239, 68, 68, 0.1);
}

.stat-pill.danger .num {
    color: var(--accent-red);
    font-size: 1.75rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.stat-pill .lbl {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.campaign-current-log h5 {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.campaign-current-log p {
    background: rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent-cyan);
}

/* Range Sliders */
.range-slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 6px;
    border-radius: 10px;
    outline: none;
    flex-grow: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-green);
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-green-glow);
    transition: var(--transition-smooth);
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.slider-value {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 80px;
}

/* Live Console Tab Layout */
.console-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.5rem;
    height: calc(100vh - 160px);
}

.console-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.console-screen {
    background: #06080a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    color: #22c55e;
    flex-grow: 1;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.console-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    padding-bottom: 0.4rem;
    line-height: 1.4;
}

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

.console-time {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.console-tag {
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.05rem 0.35rem;
    margin-right: 0.5rem;
    text-transform: uppercase;
}

.console-tag.sys {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.console-tag.in {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.console-tag.out {
    background: rgba(0, 242, 254, 0.15);
    color: var(--accent-cyan);
}

.console-tag.reply {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
}

.console-tag.err {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.console-title {
    font-weight: 600;
    color: #f1f5f9;
}

.console-msg {
    color: #e2e8f0;
    display: block;
    margin-top: 0.15rem;
    padding-left: 0.25rem;
}

.console-details {
    color: var(--text-muted);
    font-size: 0.75rem;
    display: block;
    margin-top: 0.15rem;
    padding-left: 0.25rem;
    word-break: break-all;
}

.quick-chat-card {
    height: 100%;
    overflow-y: auto;
}

/* Settings System Layout */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
}

.settings-card {
    display: flex;
    flex-direction: column;
}

.settings-card .card-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.ai-glow-icon {
    color: #a855f7;
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
}

.card-separator {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.danger-zone h4 {
    color: #ef4444;
    font-family: var(--font-heading);
    margin-bottom: 0.25rem;
}

.danger-zone p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.danger-actions-grid {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.danger-help {
    flex-grow: 1;
    margin-bottom: 0 !important;
}

/* Media Upload Area (Rule Modal) */
.media-upload-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.media-upload-dropzone {
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    text-align: center;
    transition: var(--transition-smooth);
}

.media-upload-dropzone:hover {
    border-color: rgba(0, 230, 118, 0.3);
    background: rgba(0, 230, 118, 0.03);
}

.media-upload-dropzone.drag-over {
    border-color: var(--accent-green);
    background: rgba(0, 230, 118, 0.06);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.1);
}

.media-upload-dropzone svg {
    opacity: 0.4;
    transition: var(--transition-smooth);
}

.media-upload-dropzone:hover svg {
    opacity: 0.8;
    color: var(--accent-green);
}

.upload-link {
    color: var(--accent-green);
    font-weight: 600;
}

.media-upload-preview {
    align-items: center;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
}

.media-preview-thumb {
    border-radius: 6px;
    height: 40px;
    object-fit: cover;
    width: 40px;
    border: 1px solid var(--border-color);
}

.media-preview-video-icon,
.media-preview-pdf-icon {
    align-items: center;
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    border-radius: 6px;
    color: var(--accent-cyan);
    display: flex;
    flex-direction: column;
    height: 40px;
    justify-content: center;
    width: 40px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
}

.media-preview-pdf-icon {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.media-preview-filename {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.media-remove-btn {
    flex-shrink: 0;
}

/* Table Media Cell - Inline Preview Container */
.media-cell-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.media-cell-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: block;
}

.media-cell-thumb:hover {
    border-color: var(--accent-green);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
}

.media-cell-icon {
    align-items: center;
    border-radius: 8px;
    display: inline-flex;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
}

.media-cell-icon:hover {
    transform: scale(1.05);
}

.media-cell-icon.video {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.2);
    color: var(--accent-cyan);
}

.media-cell-icon.video:hover {
    background: rgba(0, 242, 254, 0.18);
    box-shadow: 0 0 12px rgba(0, 242, 254, 0.2);
}

.media-cell-icon.pdf {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.media-cell-icon.pdf:hover {
    background: rgba(239, 68, 68, 0.18);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}

.media-cell-label {
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.3px;
}

/* Inline media overlay actions - appear on hover */
.media-cell-actions {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    gap: 0.3rem;
    z-index: 5;
}

.media-cell-wrapper:hover .media-cell-actions {
    display: flex;
}

.media-cell-wrapper:hover .media-cell-thumb {
    filter: brightness(0.4);
}

.media-cell-action-btn {
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    transition: var(--transition-smooth);
    white-space: nowrap;
}

.media-cell-action-btn:hover {
    background: rgba(0, 230, 118, 0.3);
    border-color: var(--accent-green);
}

.media-cell-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: var(--accent-red);
}

/* Media overlay icon badge on thumb */
.media-cell-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    pointer-events: none;
    transition: var(--transition-smooth);
}

.media-cell-wrapper:hover .media-cell-play-badge {
    opacity: 0;
}

.media-cell-pdf-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(239, 68, 68, 0.85);
    border-radius: 3px;
    color: #fff;
    font-size: 0.5rem;
    font-weight: 700;
    padding: 1px 4px;
    letter-spacing: 0.5px;
    pointer-events: none;
}

/* Fullscreen media preview modal */
.media-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem;
}

.media-preview-overlay.active {
    display: flex;
}

.media-preview-overlay .media-preview-content {
    max-width: 90vw;
    max-height: 85vh;
    position: relative;
    animation: zoomIn 0.25s ease;
}

.media-preview-overlay .media-preview-content img,
.media-preview-overlay .media-preview-content video {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-preview-overlay .media-preview-content embed,
.media-preview-overlay .media-preview-content iframe {
    width: 800px;
    height: 600px;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-preview-overlay .media-preview-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0.25rem 0.75rem;
    transition: var(--transition-smooth);
}

.media-preview-overlay .media-preview-close:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: var(--accent-red);
}

.media-preview-overlay .media-preview-name {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* Modals Architecture */
.modal-overlay {
    align-items: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    display: flex;
    height: 100%;
    justify-content: center;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    border-color: rgba(255,255,255,0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.75rem;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: 1rem;
}

/* View Switching */
.tab-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-panel.active {
    display: block;
}

/* Interactive Animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { opacity: 0.6; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1.02); }
}

@keyframes breathe {
    0% { box-shadow: 0 0 5px var(--accent-green-glow); opacity: 0.8; }
    50% { box-shadow: 0 0 15px var(--accent-green); opacity: 1; }
    100% { box-shadow: 0 0 5px var(--accent-green-glow); opacity: 0.8; }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
    100% { transform: translateY(0px); }
}

@keyframes borderGlow {
    0% { border-color: var(--accent-cyan); box-shadow: 0 0 10px var(--accent-cyan-glow); }
    100% { border-color: var(--accent-green); box-shadow: 0 0 10px var(--accent-green-glow); }
}

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

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Notification Toasts */
.toast-container {
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: fixed;
    right: 2rem;
    z-index: 9999;
}

.toast {
    background: rgba(17, 20, 26, 0.95);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-green);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    min-width: 280px;
    padding: 0.85rem 1.25rem;
    animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: var(--transition-smooth);
}

.toast.success {
    border-left-color: var(--accent-green);
}

.toast.error {
    border-left-color: var(--accent-red);
}

.toast.info {
    border-left-color: var(--accent-blue);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Responsiveness */
@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* simple stack override for small screens if needed */
    }
    .dashboard-core-grid, .campaigns-layout, .console-layout, .workflow-editor-grid {
        grid-template-columns: 1fr;
    }
    .console-layout {
        height: auto;
    }
    .console-screen {
        height: 400px;
    }
}
