:root {
  /* High-Contrast Minimalism Refined (Brighter HUD) */
  --bg-main: #0a0a0c;
  --bg-surface: #121214;
  --bg-panel: #18181b;
  --border-subtle: #202023;
  --border-base: #2e2e32;
  --border-strong: #3f3f46;

  --accent-blue: #60a5fa;
  --accent-purple: #a5b4fc;
  --accent-success: #4ade80;
  --accent-warning: #fbbf24;
  --accent-error: #f87171;

  --text-primary: #ffffff;
  --text-secondary: #d4d4d8;
  --text-dim: #71717a;

  --sidebar-width: 240px;
  --header-height: 56px;
  --footer-height: 40px;
}

/* Reset & base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  overflow: hidden;
}

h1,
h2,
h3,
.logo-mark {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
}

/* Container & Layout */
.container {
  position: fixed;
  top: var(--header-height);
  left: var(--sidebar-width);
  right: 0;
  bottom: var(--footer-height);
  overflow: hidden;
}

.layout {
  display: flex;
  height: 100%;
  width: 100%;
}

/* Header (HUD) */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-base);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 16px;
}

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

.logo-mark {
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(165, 180, 252, 0.3);
}

.header-info {
  display: flex;
  gap: 16px;
  align-items: center;
}

.model-name-top {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: monospace;
}

.status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

.status-dot.idle {
  background: var(--text-dim);
}

.status-dot.running {
  background: var(--accent-success);
  box-shadow: 0 0 4px var(--accent-success);
}

.status-dot.stopped {
  background: var(--accent-error);
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: var(--header-height);
  bottom: var(--footer-height);
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-base);
  display: flex;
  flex-direction: column;
  z-index: 90;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}

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

.nav-item.active {
  color: var(--accent-purple);
  background: var(--bg-panel);
  border-right: 2px solid var(--accent-purple);
  text-shadow: 0 0 8px rgba(165, 180, 252, 0.4);
}

.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  padding-top: 8px;
}

.sidebar-resizer {
  position: absolute;
  right: -4px;
  top: 0;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 100;
}

/* Main Panel */
.main-content {
  flex: 1;
  height: 100%;
  background: var(--bg-main);
  overflow: hidden;
}

.main-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
  animation: panelFadeIn 0.2s ease-out;
  min-height: 0;
  /* CRITICAL: allows flex child to shrink and scroll */
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel.hidden {
  display: none;
}

/* Search Area */
.search-container {
  flex-shrink: 0;
  /* Don't shrink the search bar */
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

.search-input {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: 4px;
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--accent-purple);
}

.search-btn {
  background: var(--accent-purple);
  color: #000;
  font-weight: 700;
  padding: 0 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 0 15px rgba(165, 180, 252, 0.2);
  transition: transform 0.1s, box-shadow 0.2s;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 20px rgba(165, 180, 252, 0.4);
}

.search-btn:active {
  transform: translateY(0);
}

/* Results */
.results-panel {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 24px;
  padding-right: 8px;
}

.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.result-card:hover {
  border-color: var(--border-strong);
}

.result-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: monospace;
}

.result-content {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* Activity Log */
.activity-log {
  flex-shrink: 0;
  /* Keep fixed height log at bottom */
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  border-radius: 4px;
  padding: 12px;
  height: 140px;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.activity-log-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}

#activity-items {
  flex: 1;
  overflow-y: auto;
}

.log-item {
  font-size: 0.75rem;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-family: monospace;
}

.log-method {
  color: var(--accent-purple);
}

.log-time {
  color: var(--text-dim);
}

/* Footer */
.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--footer-height);
  background: var(--bg-main);
  border-top: 1px solid var(--border-base);
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
}

.footer-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* Buttons and UI */
.actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.secondary-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-base);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
}

.secondary-btn:hover {
  background: var(--bg-panel);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.warning-btn:hover {
  border-color: var(--accent-warning);
  color: var(--accent-warning);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

/* Accordion */
.accordion-header {
  width: 100%;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: bold;
  text-align: left;
  cursor: pointer;
}

.accordion-content {
  padding: 0 16px 8px 16px;
  font-size: 0.75rem;
}

/* Modal */
#mcp-json-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 640px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 24px;
  z-index: 200;
  display: none;
}

#mcp-json-modal.open {
  display: block;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 190;
  display: none;
}

.modal-overlay.open {
  display: block;
}

pre {
  background: var(--bg-main);
  border: 1px solid var(--border-base);
  padding: 12px;
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: monospace;
  font-size: 0.8rem;
  max-height: 480px;
  overflow: auto;
}

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

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-dim);
  font-size: 0.9rem;
}