/* Home Command Center — Semantic Light & Dark Theme Styling */

#homeProjectLibrary {
  position: relative;
}

/* Phase 1: Hero Command Header */
.hd-hero-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line, #d7dfeb);
  border-radius: 12px;
  background: var(--surface-card, #fff);
}

.hd-hero-controls {
  display: flex;
  flex: 1 1 360px;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.hd-hero-project-picker {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted, #64748b);
}

.hd-hero-project-picker select {
  min-width: 210px;
  max-width: 300px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line-strong, #cbd5e1);
  border-radius: 8px;
  background: var(--surface-subtle, #f8fafc);
  color: var(--ink, #172033);
  font-weight: 700;
  font-size: 13px;
}

.hd-unified-search {
  position: relative;
  display: flex;
  flex: 1 1 220px;
  align-items: center;
  min-width: 180px;
}

.hd-search-icon {
  position: absolute;
  left: 10px;
  color: var(--muted, #64748b);
  font-size: 14px;
  pointer-events: none;
}

.hd-unified-search input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px 6px 30px;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 8px;
  background: var(--surface-subtle, #f8fafc);
  color: var(--ink, #172033);
  font-size: 13px;
}

/* Summary Stats & Quick-Start Cards */
.hd-command-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.hd-project-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hd-stat-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line, #dfe5ef);
  background: var(--surface-card, #fff);
  color: var(--muted, #475569);
  font-size: 11.5px;
  font-weight: 700;
}

.hd-stat-pill.is-qa.is-pass {
  border-color: rgba(22, 163, 74, .35);
  background: rgba(22, 163, 74, .12);
  color: #15803d;
}

.hd-stat-pill.is-qa.is-warn {
  border-color: rgba(217, 119, 6, .35);
  background: rgba(217, 119, 6, .14);
  color: #b45309;
}

.hd-stat-pill.is-qa.is-fail {
  border-color: rgba(220, 38, 38, .35);
  background: rgba(220, 38, 38, .12);
  color: #b91c1c;
}

.hd-quickstart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.hd-quick-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line, #d7dfeb);
  border-radius: 10px;
  background: var(--surface-card, #fff);
  color: var(--ink, #172033);
  text-align: left;
  cursor: pointer;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.hd-quick-card:hover {
  border-color: var(--brand, #2563eb);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.hd-quick-card strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.25;
}

.hd-quick-card small {
  display: block;
  font-size: 11px;
  color: var(--muted, #64748b);
}

.hd-quick-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 800;
}

.hd-quick-icon.is-blue { background: rgba(37, 99, 235, .14); color: #2563eb; }
.hd-quick-icon.is-emerald { background: rgba(16, 185, 129, .14); color: #059669; }
.hd-quick-icon.is-indigo { background: rgba(99, 102, 241, .14); color: #4f46e5; }
.hd-quick-icon.is-purple { background: rgba(139, 92, 246, .14); color: #7c3aed; }
.hd-quick-icon.is-teal { background: rgba(13, 148, 136, .14); color: #0f766e; }
.hd-quick-icon.is-amber { background: rgba(217, 119, 6, .14); color: #b45309; }

/* Phase 2: Continue Working & Live Project Pulse */
.hd-overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 980px) {
  .hd-overview-grid { grid-template-columns: 1fr; }
}

.hd-card {
  padding: 13px 14px;
  border: 1px solid var(--line, #d7dfeb);
  border-radius: 12px;
  background: var(--surface-card, #fff);
  color: var(--ink, #172033);
}

.hd-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.hd-card-head h3 { margin: 0; font-size: 14px; color: var(--ink, #172033); }
.hd-card-head p { margin: 2px 0 0; font-size: 11.5px; color: var(--muted, #64748b); }

.hd-mini-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-subtle, #f1f5f9);
  color: var(--muted, #64748b);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.hd-recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 8px;
}

.hd-file-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line, #dfe5ef);
  border-radius: 9px;
  background: var(--surface-subtle, #f8fafc);
  transition: border-color .14s ease;
}

.hd-file-card:hover { border-color: var(--brand, #2563eb); }
.hd-file-card.is-pinned { border-color: rgba(217, 119, 6, .45); }

.hd-file-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.hd-type-pill {
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
}

.hd-type-pill.is-blue, .hd-row-type-dot.is-blue { background: rgba(37, 99, 235, .14); color: #2563eb; }
.hd-type-pill.is-emerald, .hd-row-type-dot.is-emerald { background: rgba(16, 185, 129, .14); color: #059669; }
.hd-type-pill.is-amber, .hd-row-type-dot.is-amber { background: rgba(217, 119, 6, .14); color: #b45309; }
.hd-type-pill.is-teal, .hd-row-type-dot.is-teal { background: rgba(13, 148, 136, .14); color: #0f766e; }
.hd-type-pill.is-indigo, .hd-row-type-dot.is-indigo { background: rgba(99, 102, 241, .14); color: #4f46e5; }
.hd-type-pill.is-purple, .hd-row-type-dot.is-purple { background: rgba(139, 92, 246, .14); color: #7c3aed; }
.hd-type-pill.is-rose, .hd-row-type-dot.is-rose { background: rgba(225, 29, 72, .14); color: #be123c; }
.hd-type-pill.is-slate, .hd-row-type-dot.is-slate { background: rgba(100, 116, 139, .14); color: #475569; }

.hd-pin-btn,
.hd-row-pin {
  border: 0;
  background: transparent;
  color: var(--muted, #94a3b8);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.hd-pin-btn.is-pinned,
.hd-row-pin.is-pinned { color: #d97706; }

.hd-row-type-dot {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
  margin-right: 4px;
  flex: none;
}

.hd-file-card-open {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ink, #172033);
}

.hd-file-card-open strong {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-file-card-open span,
.hd-file-card-open small {
  display: block;
  font-size: 11px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pulse Rows */
.hd-pulse-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.hd-pulse-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line, #dfe5ef);
  background: var(--surface-subtle, #f8fafc);
}

.hd-pulse-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.hd-pulse-info > div { min-width: 0; }
.hd-pulse-info strong {
  display: block;
  font-size: 12px;
  color: var(--ink, #172033);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-pulse-info small {
  display: block;
  font-size: 10.5px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hd-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.hd-status-dot.is-ok { background: #16a34a; }
.hd-status-dot.is-fail { background: #dc2626; }
.hd-status-dot.is-neutral { background: #94a3b8; }

/* Phase 3: Segmented Tabs & One-Click Filter Pills */
.hd-section-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.hd-tab-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--line, #d7dfeb);
  background: var(--surface-card, #fff);
}

.hd-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted, #475569);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.hd-tab-btn.is-active {
  background: var(--brand, #2563eb);
  color: #fff;
}

.hd-tab-count {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  background: rgba(148, 163, 184, .2);
}

.hd-tab-btn.is-active .hd-tab-count {
  background: rgba(255, 255, 255, .22);
  color: #fff;
}

.hd-filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.hd-dataset-pills { margin-top: 8px; margin-bottom: 6px; }

.hd-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hd-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line, #cbd5e1);
  background: var(--surface-subtle, #f8fafc);
  color: var(--muted, #475569);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.hd-pill.is-active {
  border-color: var(--brand, #2563eb);
  background: var(--accent-soft, #eef1ff);
  color: var(--brand, #2563eb);
}

.hd-files-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 8px;
}

/* Bounded Datasets table in "All" overview mode so it never swamps the screen */
.project-library-datasets.hd-datasets-compact .project-library-datasets-table-wrap {
  max-height: 360px;
  overflow-y: auto;
}

.project-library-panel { margin-bottom: 14px; }

tr.project-library-item.is-kbd-active td {
  background: var(--accent-soft, #eef1ff);
  outline: 1px solid var(--brand, #2563eb);
}

/* Pipelines & Runs Dedicated Panel */
.hd-runs-panel {
  padding: 14px;
  margin-top: 10px;
}

.hd-runs-split {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.35fr);
  gap: 14px;
}

@media (max-width: 900px) {
  .hd-runs-split { grid-template-columns: 1fr; }
}

.hd-subhead {
  margin: 0 0 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, #64748b);
}

.hd-pipelines-list { display: grid; gap: 8px; }

.hd-pipe-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--line, #dfe5ef);
  background: var(--surface-subtle, #f8fafc);
}

.hd-pipe-card strong { display: block; font-size: 13px; color: var(--ink, #172033); }
.hd-pipe-card small { display: block; font-size: 11px; color: var(--muted, #64748b); }
.hd-pipe-actions { display: flex; align-items: center; gap: 8px; }

.hd-status-pill {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}

.hd-status-pill.is-ok { background: rgba(22, 163, 74, .14); color: #15803d; }
.hd-status-pill.is-fail { background: rgba(220, 38, 38, .14); color: #b91c1c; }
.hd-status-pill.is-neutral { background: var(--surface-subtle, #e2e8f0); color: var(--muted, #64748b); }

.hd-runs-table-host {
  overflow-x: auto;
  border: 1px solid var(--line, #dfe5ef);
  border-radius: 9px;
}

.hd-runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.hd-runs-table th,
.hd-runs-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #dfe5ef);
  text-align: left;
  color: var(--ink, #172033);
}

.hd-runs-table thead th {
  background: var(--surface-subtle, #f8fafc);
  color: var(--muted, #64748b);
  font-size: 11px;
  text-transform: uppercase;
}

.hd-drop-overlay[hidden],
.hd-files-card-grid[hidden],
.hd-runs-panel[hidden],
.hd-stat-pill[hidden] {
  display: none !important;
}

/* Phase 4: Drag-and-Drop Overlay */
.hd-drop-overlay {
  position: fixed;
  inset: 14px;
  z-index: 1500;
  display: grid;
  place-items: center;
  border: 2.5px dashed var(--brand, #2563eb);
  border-radius: 16px;
  background: rgba(15, 23, 42, .62);
  backdrop-filter: blur(4px);
}

.hd-drop-box {
  padding: 28px 36px;
  border-radius: 14px;
  background: var(--surface-card, #fff);
  color: var(--ink, #172033);
  text-align: center;
  max-width: 420px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}

.hd-drop-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--accent-soft, #eef1ff);
  color: var(--brand, #2563eb);
  font-size: 24px;
  font-weight: 800;
}

.hd-drop-box p { margin: 6px 0 0; font-size: 12.5px; color: var(--muted, #64748b); }

/* Dark Theme Semantic Polish */
html[data-theme="dark"] .hd-tab-btn.is-active {
  background: #2563eb;
  color: #ffffff;
}
html[data-theme="dark"] .hd-stat-pill.is-qa.is-pass,
html[data-theme="dark"] .hd-status-pill.is-ok { color: #4ade80; }
html[data-theme="dark"] .hd-stat-pill.is-qa.is-fail,
html[data-theme="dark"] .hd-status-pill.is-fail { color: #f87171; }
html[data-theme="dark"] .hd-stat-pill.is-qa.is-warn { color: #fbbf24; }
html[data-theme="dark"] .hd-type-pill.is-blue, html[data-theme="dark"] .hd-quick-icon.is-blue { color: #93c5fd; }
html[data-theme="dark"] .hd-type-pill.is-emerald, html[data-theme="dark"] .hd-quick-icon.is-emerald { color: #6ee7b7; }
html[data-theme="dark"] .hd-type-pill.is-amber, html[data-theme="dark"] .hd-quick-icon.is-amber { color: #fcd34d; }
html[data-theme="dark"] .hd-type-pill.is-teal, html[data-theme="dark"] .hd-quick-icon.is-teal { color: #5eead4; }
html[data-theme="dark"] .hd-type-pill.is-indigo, html[data-theme="dark"] .hd-quick-icon.is-indigo { color: #a5b4fc; }
html[data-theme="dark"] .hd-type-pill.is-purple, html[data-theme="dark"] .hd-quick-icon.is-purple { color: #c4b5fd; }
html[data-theme="dark"] .hd-type-pill.is-slate { color: #cbd5e1; }
