:root {
    --bg-base: #0b0f19;
    --bg-surface: #111827;
    --bg-card: #182235;
    --bg-card-hover: #1f2c44;
    --bg-input: #0d1524;
    --border-color: #24324d;
    --border-subtle: #1c273c;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.25);
    --accent-hover: #2563eb;
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --critical: #ef4444;
    --critical-bg: rgba(239, 68, 68, 0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Hidden Utility */
.hidden { display: none !important; }

/* LOGIN SCREEN */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 20%, #172554 0%, #0b0f19 80%);
    padding: 20px;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 420px;
    padding: 36px;
    text-align: left;
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.brand-badge-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 0 25px var(--accent-glow);
}

.login-brand h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.login-subtext {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.ssl-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input, .form-select, .table-search {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus, .form-select:focus, .table-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-error {
    background-color: var(--critical-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 16px;
    color: var(--text-muted);
    font-size: 12px;
}

.login-footer code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--accent);
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* APP LAYOUT */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-header {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo-mark {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

.logo-title {
    display: block;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: -0.01em;
}

.logo-sub {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
}

.sidebar-nav {
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    width: 100%;
    transition: all 0.15s ease;
}

.nav-item:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    font-weight: 600;
}

.nav-item.active svg {
    stroke: #60a5fa;
}

.badge-pill-small {
    margin-left: auto;
    font-size: 10px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 2px 6px;
    border-radius: 12px;
}

.badge-count {
    margin-left: auto;
    font-size: 11px;
    background: var(--critical);
    color: #fff;
    padding: 1px 7px;
    border-radius: 12px;
    font-weight: 700;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.system-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.status-title { display: block; font-size: 11px; font-weight: 600; color: #34d399; }
.status-ip { display: block; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* TOPBAR */
.topbar {
    height: 60px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.live-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.pulse-indicator {
    width: 6px;
    height: 6px;
    background: #34d399;
    border-radius: 50%;
    animation: pulseGlow 1.5s infinite;
}

.topbar-time {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-secondary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.pill-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

.pill-label { color: var(--text-muted); font-size: 11px; }
.pill-val { font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); }

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.user-name { font-size: 13px; font-weight: 600; }

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 6px;
    border-radius: 4px;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-logout:hover {
    color: var(--critical);
    background-color: var(--critical-bg);
}

/* TAB PANES */
.tab-pane {
    display: none;
    padding: 28px;
}

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

.page-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title-row h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* METRIC CARDS GRID */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: #334155;
}

.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.metric-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.metric-badge {
    font-size: 11px;
    font-weight: 600;
    background: var(--bg-surface);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.metric-value-row {
    margin: 14px 0 10px;
}

.metric-big {
    font-size: 28px;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.metric-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.net-pills {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* CHARTS GRID */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

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

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.chart-container {
    height: 220px;
    position: relative;
}

/* SUMMARY GRID */
.summary-grid, .two-col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 20px;
}

.info-table {
    display: flex;
    flex-direction: column;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 13px;
}

.info-row:last-child { border-bottom: none; }
.info-key { color: var(--text-secondary); }
.info-val { font-weight: 600; font-family: var(--font-mono); }

.badge-online {
    background: var(--success-bg);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-warning {
    background: var(--warning-bg);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.badge-critical {
    background: var(--critical-bg);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
}

.text-warning { color: #fbbf24 !important; }
.text-success { color: #34d399 !important; }
.text-danger { color: #f87171 !important; }

/* DATA TABLES */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.data-table th {
    background: var(--bg-surface);
    color: var(--text-secondary);
    padding: 10px 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
}

.data-table tr:hover td {
    background-color: var(--bg-card-hover);
}

.mt-4 { margin-top: 24px; }
.mt-3 { margin-top: 16px; }

/* ESXi GRID */
.esxi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.esxi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
}

.esxi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.esxi-card-header h4 {
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-mono);
}

/* OLLAMA CHAT INTERFACE */
.chat-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.control-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-select {
    padding: 6px 12px;
    font-size: 13px;
}

.toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
}

.toggle-container input { display: none; }

.toggle-slider {
    width: 36px;
    height: 20px;
    background-color: var(--border-color);
    border-radius: 20px;
    position: relative;
    transition: background-color 0.2s ease;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #fff;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

.toggle-container input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle-container input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.prompt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chip:hover {
    background: var(--bg-card-hover);
    color: #60a5fa;
    border-color: #3b82f6;
}

.chat-window {
    height: 480px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background-color: #0d131f;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background: #2563eb;
}

.message-body {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.6;
}

.chat-message.user .message-body {
    background: #1e3a8a;
    border-color: #2563eb;
    color: #eff6ff;
}

.message-sender {
    font-size: 11px;
    font-weight: 700;
    color: #93c5fd;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-badge {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
}

.thought-accordion {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed #334155;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 12px;
    color: #94a3b8;
    font-family: var(--font-mono);
}

.thought-header {
    cursor: pointer;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
    user-select: none;
}

.chat-input-bar {
    display: flex;
    gap: 10px;
}

.chat-input-bar textarea {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 12px 14px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    outline: none;
    min-height: 48px;
    max-height: 120px;
}

.chat-input-bar textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* SETTINGS CARD FOOTER */
.card-footer-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 13px;
}

.setup-steps {
    margin-left: 20px;
    margin-top: 6px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.setup-steps code {
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: #60a5fa;
}

.service-links-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.service-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
}

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

.service-meta {
    flex: 1;
}

.service-meta strong {
    font-size: 14px;
    display: block;
}

.service-meta p {
    font-size: 12px;
    color: var(--text-muted);
}

/* RESPONSIVE */
@media (max-width: 900px) {
    .app-layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
    .charts-grid { grid-template-columns: 1fr; }
    .two-col-grid { grid-template-columns: 1fr; }
}
