:root {
    --bg-dark: #070a13;
    --bg-workspace: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.65);
    --bg-input: rgba(15, 23, 42, 0.6);
    --border-color: rgba(255, 255, 255, 0.06);
    --border-active: rgba(99, 102, 241, 0.35);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    
    --text-main: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --transition-fast: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    
    --sidebar-width: 290px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    height: 100vh;
}

code, pre {
    font-family: var(--font-mono);
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #0b0f19 0%, #060913 100%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

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

.brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--text-main);
    gap: 12px;
}

.brand-icon {
    font-size: 24px;
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: -0.5px;
    display: flex;
    flex-direction: column;
}

.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    width: fit-content;
}

.badge-alpha {
    background-color: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
    margin-top: 4px;
}

.badge-indigo {
    background-color: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.25);
}

.badge-verified {
    background-color: var(--success-bg);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Sidebar Search */
.sidebar-search {
    padding: 16px 20px;
}

.sidebar-search input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition-fast);
}

.sidebar-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 16px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    padding: 16px 8px 8px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition-fast);
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.03);
}

.nav-link.active {
    color: var(--text-main);
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    box-shadow: inset 0 0 8px rgba(99, 102, 241, 0.05);
}

.nav-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

/* Workspace Area */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-workspace);
    overflow: hidden;
}

.workspace-header {
    height: 64px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(11, 15, 25, 0.5);
    backdrop-filter: blur(8px);
}

.breadcrumbs {
    font-size: 13.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.crumb-root {
    color: var(--text-muted);
}

.crumb-separator {
    color: rgba(255, 255, 255, 0.1);
}

.crumb-current {
    color: var(--text-main);
}

.system-status {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-text {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Workspace Content Wrapper */
.workspace-content {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.workspace-content::-webkit-scrollbar {
    width: 8px;
}

.workspace-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.welcome-banner {
    margin-bottom: 8px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 400;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    backdrop-filter: blur(12px);
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-blue { background-color: rgba(59, 130, 246, 0.1); border: 1px solid rgba(59, 130, 246, 0.15); }
.icon-purple { background-color: rgba(168, 85, 247, 0.1); border: 1px solid rgba(168, 85, 247, 0.15); }
.icon-indigo { background-color: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.15); }
.icon-teal { background-color: rgba(20, 184, 166, 0.1); border: 1px solid rgba(20, 184, 166, 0.15); }

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

.stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.8px;
    margin-bottom: 4px;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Cards System */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.card h2, .card h3 {
    font-family: var(--font-display);
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.card h2 { font-size: 22px; }
.card h3 { font-size: 17px; }

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

.card-header-flex h2, .card-header-flex h3 {
    margin-bottom: 0;
}

.text-secondary {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Diagram System */
.diagram-wrapper {
    background: #04060b;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 24px;
    overflow-x: auto;
    display: flex;
    justify-content: center;
}

.mermaid {
    color: var(--text-main);
}

/* Table Design */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(0,0,0,0.15);
}

.flows-table, .steps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    text-align: left;
}

.flows-table th, .steps-table th {
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 18px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
}

.flows-table td, .steps-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.flows-table tr:last-child td, .steps-table tr:last-child td {
    border-bottom: none;
}

.cell-icon {
    font-size: 20px;
    text-align: center;
    width: 40px;
}

.cell-title {
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.cell-desc {
    color: var(--text-secondary);
    line-height: 1.5;
    min-width: 300px;
}

.cell-services {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.service-tag {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.btn {
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.btn-sm {
    font-size: 12px;
    padding: 6px 12px;
}

/* Flow Details Container */
.flow-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 32px;
    animation: fadeIn 0.35s ease-out;
}

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

.flow-header {
    background: linear-gradient(90deg, rgba(17, 24, 39, 0.8) 0%, rgba(17, 24, 39, 0.3) 100%);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
}

.flow-title-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
}

.flow-badge-icon {
    font-size: 32px;
    width: 60px;
    height: 60px;
    background-color: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flow-detail-title {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.flow-detail-slug {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.flow-detail-slug code {
    background: rgba(0,0,0,0.2);
    padding: 1px 6px;
    border-radius: 4px;
    color: #a5b4fc;
}

.flow-detail-overview {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
}

@media (max-width: 1100px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

.col-main, .col-sidebar {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Flow Steps Detail */
.cell-num {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 800;
    color: var(--primary);
    text-align: center;
}

.actor-tag {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    display: block;
    text-align: center;
    width: fit-content;
}

.actor-Buyer { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.actor-Seller { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.2); }
.actor-API { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.2); }
.actor-User { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; border: 1px solid rgba(20, 184, 166, 0.2); }
.actor-Product { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.2); }
.actor-Order { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.actor-NATS { background: rgba(239, 68, 68, 0.15); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }

.cell-action {
    color: var(--text-main);
    line-height: 1.5;
}

.cell-rationale {
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.5;
}

/* Payloads Code Tabs */
.payload-tabs-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 14px;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin: 16px 0;
    gap: 4px;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tabs-panes {
    position: relative;
}

.tab-pane {
    display: none;
}

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

.pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #04060a;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 6px 12px;
}

.lang-tag {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.btn-copy, .btn-copy-term {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-copy:hover, .btn-copy-term:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-main);
}

.tab-pane pre {
    background: #020306;
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    max-height: 450px;
}

.tab-pane code {
    font-size: 12.5px;
    line-height: 1.5;
    color: #e2e8f0;
}

/* Validations List */
.rules-list, .errors-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
}

.bullet-check {
    color: var(--success);
    margin-right: 6px;
    font-weight: 700;
}

.bullet-warning {
    color: var(--warning);
    margin-right: 6px;
    font-weight: 700;
}

/* Debugging console block */
.debugging-cli {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.debug-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-bottom: -10px;
}

.code-terminal {
    background: #020305;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.terminal-prompt {
    color: var(--primary);
    font-weight: 700;
    user-select: none;
}

.terminal-cmd {
    flex: 1;
    overflow-x: auto;
    font-size: 12px;
    color: #cbd5e1;
    white-space: nowrap;
}

.terminal-cmd::-webkit-scrollbar {
    display: none;
}

.btn-copy-term {
    flex-shrink: 0;
}
