* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}

/* Top nav */
.topnav {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: #161822;
  border-bottom: 1px solid #2a2d3a;
}
.topnav h1 { font-size: 1.1rem; font-weight: 600; color: #fff; }
.topnav .tabs { display: flex; gap: 4px; }
.tab-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: #8b8fa3;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.tab-btn:hover { color: #e0e0e0; background: #1e2030; }
.tab-btn.active { color: #fff; background: #7c8aff; border-color: #7c8aff; }

.logout-form { margin-left: auto; }
.logout-btn { color: #f56565 !important; }
.logout-btn:hover { background: rgba(245, 101, 101, 0.1) !important; }

/* Main layout */
.main { display: flex; height: calc(100vh - 52px); }

/* Sidebar */
.sidebar {
  width: 340px;
  min-width: 340px;
  background: #161822;
  border-right: 1px solid #2a2d3a;
  display: flex;
  flex-direction: column;
}
.search-box {
  padding: 12px 16px;
  border-bottom: 1px solid #2a2d3a;
}
.search-box input {
  width: 100%;
  padding: 8px 12px;
  background: #1e2030;
  border: 1px solid #2a2d3a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.85rem;
  outline: none;
}
.search-box input:focus { border-color: #7c8aff; }
.search-box input::placeholder { color: #555870; }
.sort-bar {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid #2a2d3a;
}
.sort-btn {
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #8b8fa3;
  font-size: 0.75rem;
  cursor: pointer;
}
.sort-btn.active { color: #7c8aff; background: rgba(124, 138, 255, 0.1); }
.sort-btn.active::after { content: ' \25BC'; font-size: 0.6rem; }

.item-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.item-list::-webkit-scrollbar { width: 6px; }
.item-list::-webkit-scrollbar-track { background: transparent; }
.item-list::-webkit-scrollbar-thumb { background: #2a2d3a; border-radius: 3px; }

.list-item {
  padding: 10px 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.1s;
}
.list-item:hover { background: #1e2030; }
.list-item.active { background: #1e2030; border-left-color: #7c8aff; }
.list-item-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-sub {
  font-size: 0.75rem;
  color: #8b8fa3;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item-stats {
  display: flex;
  gap: 12px;
  margin-top: 3px;
  font-size: 0.72rem;
  color: #555870;
}
.list-item-stats span { color: #7c8aff; font-weight: 500; }

/* Content area */
.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.content-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid #2a2d3a;
}
.content-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.content-header p { font-size: 0.82rem; color: #8b8fa3; }
.content-stats {
  display: flex;
  gap: 24px;
  margin-top: 8px;
  font-size: 0.8rem;
}
.content-stats .stat-val { color: #7c8aff; font-weight: 600; }
.content-stats .stat-label { color: #8b8fa3; margin-left: 4px; }

.chart-area {
  flex: 1;
  padding: 16px 24px;
  overflow-y: auto;
}
.chart-wrapper {
  position: relative;
  width: 100%;
}

/* Detail pane */
.detail-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* Empty state */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #555870;
  font-size: 0.95rem;
}

/* Hidden view */
.view { display: none; }
.view.active { display: flex; height: calc(100vh - 52px); }

/* Phylum filter bar */
.phylum-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 24px;
  border-bottom: 1px solid #2a2d3a;
}
.phylum-btn {
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #2a2d3a;
  background: transparent;
  color: #8b8fa3;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}
.phylum-btn:hover { color: #e0e0e0; border-color: #555870; }
.phylum-btn.active { color: #fff; background: #7c8aff; border-color: #7c8aff; }

/* Error messages */
.error-msg {
  padding: 12px 16px;
  color: #f56565;
  font-size: 0.85rem;
  text-align: center;
}

/* Truncation notice */
.truncation-notice {
  padding: 8px 0;
  color: #8b8fa3;
  font-size: 0.78rem;
  text-align: center;
  border-bottom: 1px solid #2a2d3a;
}

/* Search landing */
.search-landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 80px;
}
.search-box-prominent {
  width: 100%;
  max-width: 600px;
  border-bottom: none;
}
.search-box-prominent input {
  font-size: 1.1rem;
  padding: 14px 20px;
}
.search-results {
  width: 100%;
  max-width: 800px;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.search-section {
  padding: 0 16px;
}
.search-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #8b8fa3;
  margin-bottom: 8px;
}

/* Login page */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-container h1 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 8px;
}
.login-subtitle {
  color: #8b8fa3;
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}
.login-form label {
  font-size: 0.85rem;
  color: #8b8fa3;
}
.login-form input {
  width: 100%;
  padding: 10px 14px;
  background: #1e2030;
  border: 1px solid #2a2d3a;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 0.95rem;
  outline: none;
}
.login-form input:focus { border-color: #7c8aff; }
.login-form button {
  padding: 10px 20px;
  background: #7c8aff;
  border: none;
  border-radius: 6px;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.login-form button:hover { background: #6b79e8; }
