:root {
    --bg-dark: #090d16;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-hover: rgba(26, 36, 61, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: #38bdf8;
    
    --primary: #38bdf8;
    --primary-glow: rgba(56, 189, 248, 0.25);
    --accent: #818cf8;
    --emerald: #34d399;
    --purple: #818cf8;
    --orange: #f97316;
    --red: #f43f5e;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fira Code', monospace;
    
    --sidebar-width: 260px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(249, 115, 22, 0.06) 0%, transparent 40%);
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(11, 15, 25, 0.95);
    backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.brand-name {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}

.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
    margin-top: 4px;
}

.airgap-badge {
    background: rgba(52, 211, 153, 0.15);
    color: var(--emerald);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

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

.nav-item.active {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
    color: var(--primary);
    border-left: 3px solid var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

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

.cluster-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.online {
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
}

.status-title {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-sub {
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 30px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(10px);
}

.header-title h2 {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.header-subtitle {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

.domain-tag {
    background: rgba(129, 140, 248, 0.12);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    border: 1px solid rgba(129, 140, 248, 0.3);
    font-family: monospace;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

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

/* Tab Contents */
.tab-content {
    display: none;
    padding: 24px 30px;
    flex: 1;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   AGENT OBSERVATORY STYLES (SPEEDOMETER GAUGE & ENHANCED FILTERS)
   ========================================================================== */

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

.obs-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.obs-diamond {
    color: var(--orange);
    font-size: 1.2rem;
}

.obs-main-heading {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #fff;
}

.obs-sub-heading {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-left: 8px;
}

.obs-timerange-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.time-btn-group {
    display: flex;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.time-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-btn.active, .time-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.live-status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--emerald);
    background: rgba(52, 211, 153, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--emerald);
    box-shadow: 0 0 8px var(--emerald);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* Custom Date Range Picker Bar */
.date-range-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.date-range-bar label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.date-range-bar input[type="date"] {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.btn-apply-date {
    background: var(--primary);
    color: #000;
    border: none;
    padding: 5px 14px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.orange-border::before { background: var(--orange); }
.purple-border::before { background: var(--purple); }
.cyan-border::before { background: var(--primary); }
.red-border::before { background: var(--red); }
.green-border::before { background: var(--emerald); }

.kpi-title {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.kpi-value {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}

.orange-text { color: var(--orange); }
.purple-text { color: var(--purple); }
.cyan-text { color: var(--primary); }
.red-text { color: var(--red); }
.green-text { color: var(--emerald); }

.kpi-sub {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}

/* Speedometer Gauge Styling */
.speedo-card {
    padding: 12px 16px 8px 16px;
}

.speedo-container {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.speedo-svg {
    width: 100%;
    max-height: 90px;
    overflow: visible;
}

#speedo-needle-group {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: 80px 80px;
}

#speedo-arc {
    transition: stroke-dashoffset 0.6s ease;
}

.speedo-readout {
    margin-top: -16px;
    text-align: center;
}

.speedo-readout .kpi-value {
    font-size: 1.5rem;
}

/* Observatory Charts Grid (2x2) */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(8px);
}

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

.chart-title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

.chart-unit {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-dim);
}

.chart-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-box {
    width: 100px;
    height: 10px;
    border-radius: 2px;
}

.green-box { background: var(--emerald); }
.cyan-box { background: var(--primary); }
.orange-box { background: var(--orange); }
.purple-box { background: var(--purple); }

.chart-body {
    width: 100%;
    height: 180px;
    position: relative;
}

.chart-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Chat Layout & Components */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-right: 10px;
    margin-bottom: 20px;
}

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

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

.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    box-shadow: 0 0 10px var(--primary-glow);
}

.message.user .avatar {
    background: linear-gradient(135deg, var(--purple) 0%, #ec4899 100%);
}

.message-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.6;
    backdrop-filter: blur(10px);
}

.suggested-queries {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.chip-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover {
    background: rgba(56, 189, 248, 0.15);
    color: var(--primary);
    border-color: var(--primary);
}

.chat-input-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.95rem;
}

.send-btn {
    background: var(--primary);
    border: none;
    color: #000;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.send-btn:hover {
    transform: scale(1.05);
}

.input-options {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.latency-indicator {
    margin-left: auto;
    color: var(--emerald);
    font-weight: 500;
}

/* Cards & Layout Grid */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.form-group input, .form-group select, .form-group textarea {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
}

.btn {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--emerald) 0%, var(--primary) 100%);
    color: #000;
}

/* GPU Grid */
.gpu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

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

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

.gpu-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.bar-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}

.bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--emerald) 100%);
    transition: width 0.4s ease;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.margin-top {
    margin-top: 24px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.res-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    border: 1px solid var(--border-color);
}

.res-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--emerald);
}

.res-lbl {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.placeholder-box {
    padding: 40px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.hidden {
    display: none;
}

/* --- Model Auto-Fitting & Host Setup CSS Additions --- */
.autofit-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.select-row {
    display: flex;
    gap: 12px;
}

.select-row select {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.autofit-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.autofit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    font-family: var(--font-mono);
}

.autofit-table th, .autofit-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.autofit-table th {
    background: rgba(15, 23, 42, 0.8);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
}

.fit-pass {
    background: rgba(52, 211, 153, 0.04);
}

.fit-fail {
    background: rgba(248, 113, 113, 0.04);
    opacity: 0.65;
}

.badge-pass {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
    border: 1px solid #34d399;
    padding: 2px 6px;
    border-radius: 3px;
}

.badge-fail {
    background: rgba(248, 113, 113, 0.2);
    color: #f87171;
    border: 1px solid #f87171;
    padding: 2px 6px;
    border-radius: 3px;
}

.quant-pill {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.reason-cell {
    color: var(--text-muted);
    font-size: 0.78rem;
}

/* Local Auth Credentials Box */
.local-auth-card {
    background: rgba(129, 140, 248, 0.06);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: var(--radius-sm);
    padding: 16px;
}

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

.auth-badge {
    background: rgba(129, 140, 248, 0.2);
    color: #818cf8;
    border: 1px solid #818cf8;
}

.auth-status-text {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--emerald);
}

.auth-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.admin-credentials-box {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.cred-row {
    margin-bottom: 6px;
    color: var(--text-main);
}

.cred-row:last-child {
    margin-bottom: 0;
}

.highlight-pwd {
    color: #f97316;
    font-weight: 700;
    background: rgba(249, 115, 22, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
}

.admin-tag {
    color: #34d399;
    font-weight: 600;
}

/* Host details list */
.host-details-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.detail-item {
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slot-item {
    background: rgba(56, 189, 248, 0.04);
    padding: 6px 12px;
    border-radius: 4px;
    border-left: 3px solid var(--primary);
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.slot-badge {
    background: rgba(56, 189, 248, 0.2);
    color: var(--primary);
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 600;
}

