* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f172a;
    color: #e2e8f0;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #1e293b;
    margin-bottom: 30px;
}

header h1 {
    color: #60a5fa;
    font-size: 28px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #1e293b;
    border-radius: 20px;
    font-size: 14px;
}

.status-indicator .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 2s infinite;
}

.status-indicator.error .dot {
    background: #ef4444;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

nav {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 1px solid #1e293b;
    padding-bottom: 10px;
}

.nav-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

.nav-btn:hover {
    color: #60a5fa;
}

.nav-btn.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #1e293b;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #334155;
}

.stat-card h3 {
    font-size: 14px;
    color: #94a3b8;
    margin-bottom: 12px;
    font-weight: 500;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #60a5fa;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 12px;
    color: #64748b;
}

.chart-container {
    background: #1e293b;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #334155;
    margin-bottom: 20px;
}

.chart-container h3 {
    color: #94a3b8;
    margin-bottom: 16px;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.health-item {
    padding: 16px;
    background: #0f172a;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.health-item.ok {
    border-left: 4px solid #22c55e;
}

.health-item.error {
    border-left: 4px solid #ef4444;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.view-header h2 {
    color: #94a3b8;
}

.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-secondary {
    padding: 8px 16px;
    background: #334155;
    color: #e2e8f0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #475569;
}

.table-container {
    background: #1e293b;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #334155;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #0f172a;
}

th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    color: #94a3b8;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    padding: 12px 16px;
    border-top: 1px solid #334155;
}

tr:hover {
    background: #0f172a;
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.badge.success {
    background: #22c55e33;
    color: #22c55e;
}

.badge.error {
    background: #ef444433;
    color: #ef4444;
}

.btn-sm {
    padding: 4px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.btn-sm:hover {
    background: #2563eb;
}

.errors-container {
    max-height: 600px;
    overflow-y: auto;
}

.error-item {
    background: #1e293b;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid;
}

.error-item.critical {
    border-left-color: #ef4444;
}

.error-item.error {
    border-left-color: #f59e0b;
}

.error-item.warning {
    border-left-color: #eab308;
}

.error-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.error-service {
    color: #60a5fa;
    font-weight: 600;
}

.error-time {
    color: #64748b;
    font-size: 12px;
}

.error-message {
    color: #e2e8f0;
    margin-bottom: 4px;
}

.config-container, .feature-flags {
    background: #1e293b;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.config-item, .feature-item {
    padding: 12px;
    background: #0f172a;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-key {
    color: #60a5fa;
    font-weight: 500;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #22c55e;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: #1e293b;
    margin: 5% auto;
    padding: 30px;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.close {
    color: #94a3b8;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #e2e8f0;
}

.profile-section {
    margin: 20px 0;
}

.profile-section h3 {
    color: #60a5fa;
    margin-bottom: 12px;
}

.profile-facts, .profile-events, .profile-relationships {
    display: grid;
    gap: 8px;
}

.fact-item, .event-item, .relationship-item {
    padding: 12px;
    background: #0f172a;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
}

select {
    padding: 8px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    font-size: 14px;
}

input[type="checkbox"] {
    margin-right: 6px;
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #0f172a;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.sortable {
    cursor: pointer;
    user-select: none;
}

.sortable:hover {
    background: #334155;
}

.sort-arrow {
    color: #64748b;
    font-size: 12px;
}

/* Engagement Metrics Service Cards */
.services-section {
    margin-bottom: 30px;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.service-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    transition: border-color 0.3s;
}

.service-card.highlight {
    border-color: #f59e0b;
    box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
}

.service-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #334155;
}

.service-header h4 {
    margin: 0;
    color: #f1f5f9;
    font-size: 14px;
    font-weight: 600;
}

.service-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
}

.status-dot.healthy {
    background: #10b981;
}

.status-dot.degraded {
    background: #f59e0b;
}

.status-dot.critical {
    background: #ef4444;
}

.status-dot.offline {
    background: #6b7280;
}

.status-text {
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
    color: #94a3b8;
}

.status-text.healthy {
    color: #10b981;
}

.status-text.degraded {
    color: #f59e0b;
}

.status-text.critical {
    color: #ef4444;
}

.status-text.offline {
    color: #6b7280;
}

.service-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 4px 0;
}

.metric-label {
    color: #94a3b8;
    font-weight: 400;
}

.metric-value {
    color: #f1f5f9;
    font-weight: 500;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

.metric-item.success .metric-value {
    color: #10b981;
}

.metric-item.error .metric-value {
    color: #ef4444;
}

.metric-item.highlight .metric-value {
    color: #f59e0b;
    font-weight: 600;
}

/* Performance Indicators */
.performance-indicators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.indicator-card {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
}

.indicator-label {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 4px;
}

.indicator-value {
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 12px;
}

.indicator-status {
    margin-top: 8px;
}

.indicator-bar {
    width: 100%;
    height: 8px;
    background: #334155;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.indicator-fill {
    height: 100%;
    background: #3b82f6;
    transition: width 0.5s ease;
}

.indicator-text {
    font-size: 11px;
    color: #64748b;
}

/* Global Config JSON Display */
.global-config-container {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.json-display {
    background: #0f172a;
    color: #e2e8f0;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
    padding: 20px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

.json-display .json-key {
    color: #60a5fa;
}

.json-display .json-string {
    color: #10b981;
}

.json-display .json-number {
    color: #f59e0b;
}

.json-display .json-boolean {
    color: #8b5cf6;
}

.json-display .json-null {
    color: #6b7280;
}

/* Config Sections */
.config-section {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.config-section:hover {
    border-color: #475569;
}

.config-section-header {
    background: #0f172a;
    padding: 15px;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s;
}

.config-section-header:hover {
    background: #1e293b;
}

.config-section-header h4 {
    margin: 0;
    color: #f1f5f9;
    font-size: 16px;
    font-weight: 600;
}

.config-section-content {
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.expand-icon {
    color: #64748b;
    font-size: 14px;
    transition: transform 0.2s ease;
    user-select: none;
}

/* Form-ready styling for future editability */
.config-section.editable {
    border-color: #3b82f6;
}

.config-section.editable .config-section-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

.config-section.editable .config-section-header h4 {
    color: #ffffff;
}

/* Future form elements styling */
.config-form-field {
    margin-bottom: 12px;
    padding: 8px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
}

.config-form-field label {
    display: block;
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 4px;
    font-weight: 500;
}

.config-form-field input,
.config-form-field textarea,
.config-form-field select {
    width: 100%;
    padding: 8px;
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 14px;
}

.config-form-field input:focus,
.config-form-field textarea:focus,
.config-form-field select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.config-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #334155;
}

.config-actions .btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
}

.config-actions .btn-primary:hover {
    background: #2563eb;
}

.config-actions .btn-secondary {
    background: #374151;
    color: #d1d5db;
}

.config-actions .btn-secondary:hover {
    background: #4b5563;
}

/* Config Form Layout */
.config-form-container {
    padding: 0;
}

.config-form-section {
    margin-bottom: 8px;
    padding: 8px 0;
    border-bottom: 1px solid #334155;
    color: #60a5fa;
    font-weight: 600;
    font-size: 14px;
}

.config-form-field {
    display: flex;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 15px;
}

.config-form-field label {
    min-width: 200px;
    color: #94a3b8;
    font-size: 13px;
    font-weight: 500;
    padding-top: 8px;
    word-break: break-word;
    flex-shrink: 0;
}

.config-value-input {
    flex: 1;
    min-height: 32px;
    max-height: 120px;
    padding: 8px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 4px;
    color: #f1f5f9;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.4;
}

.config-value-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.config-value-input:hover {
    border-color: #64748b;
}

/* Indentation styling */
.config-form-container .config-form-section:first-child {
    margin-top: 0;
}

.config-form-container .config-form-field:last-child {
    margin-bottom: 0;
}

/* Config Navigation Buttons */
.config-nav-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0;
}

.config-nav-btn {
    padding: 8px 16px;
    background: #334155;
    color: #e2e8f0;
    border: 1px solid #475569;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.config-nav-btn:hover {
    background: #475569;
    border-color: #64748b;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.config-nav-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Special styling for global config button */
.config-nav-btn:first-child {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    border-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.config-nav-btn:first-child:hover {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: #2563eb;
}

/* Help Icons */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #475569;
    color: #e2e8f0;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: help;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.help-icon:hover {
    background: #3b82f6;
    color: white;
    transform: scale(1.1);
}

/* Tooltip styling */
.help-icon[title]:hover::after {
    content: attr(title);
    position: absolute;
    z-index: 1000;
    background: #1e293b;
    color: #f1f5f9;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #475569;
    font-size: 12px;
    font-weight: normal;
    line-height: 1.4;
    max-width: 300px;
    word-wrap: break-word;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    margin-top: 24px;
    margin-left: -150px;
    white-space: normal;
}


