/* ============================================
   COMMAND CENTER — App Shell
   Topbar, nav, queue panel, board, kanban,
   metrics bar, terminal. Overrides legacy
   styles.css rules (loaded after it).
   ============================================ */

/* Full-bleed frame: no floating panels */
.app {
  padding: 0;
  gap: 0;
}

.main-content {
  gap: 0;
}

/* ---------- Top bar ---------- */
.topbar {
  height: 48px;
  padding: 0 var(--space-lg);
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border-default);
  border-radius: 0;
  box-shadow: none;
}

.topbar-left {
  height: 100%;
  gap: var(--space-2xl);
}

.topbar-brand {
  font-size: var(--text-md);
  font-weight: 600;
}

.topbar-nav {
  height: 100%;
  gap: var(--space-xs);
}

.nav-tab {
  height: 100%;
  padding: 0 var(--space-md);
  border-radius: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
}

.nav-tab:hover {
  color: var(--text-primary);
  background: transparent;
}

.nav-tab.active {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

/* ---------- Queue panel ---------- */
.queue-panel {
  background: var(--bg-surface);
  border: none;
  border-right: 1px solid var(--border-default);
  border-radius: 0;
  box-shadow: none;
}

.queue-header {
  border-bottom: 1px solid var(--border-subtle);
}

.queue-section-header {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.section-label {
  font-weight: 600;
}

.section-count {
  background: var(--count-bg);
  border-radius: 999px;
  font-weight: 600;
}

.queue-ticket {
  border-radius: var(--radius-md);
}

.queue-ticket-subject {
  font-weight: 500;
}

/* ---------- Board area ---------- */
.board-area {
  background: var(--bg-base);
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.board-header {
  padding: var(--space-md) var(--space-lg) var(--space-xs);
  border-bottom: none;
}

.board-header h2 {
  font-size: var(--text-md);
  font-weight: 600;
}

/* ---------- Metrics: one bordered stat bar ---------- */
.metrics-strip {
  margin: var(--space-md) var(--space-lg) 0;
  padding: 0;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.metric-card {
  flex: 1;
  align-items: flex-start;
  padding: var(--space-sm) var(--space-lg);
  min-width: 90px;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.metric-card + .metric-card {
  border-left: 1px solid var(--border-subtle);
}

.metric-value {
  font-size: var(--text-lg);
  font-weight: 600;
}

.metric-label {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
}

.metrics-strip .btn {
  margin: 0 var(--space-md);
  flex-shrink: 0;
}

/* ---------- Kanban ---------- */
.kanban-board {
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.kanban-column {
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.column-header {
  padding: var(--space-sm) var(--space-md);
}

.ticket-card {
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.ticket-card:hover {
  transform: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.ticket-card.dragging {
  opacity: 0.5;
  transform: none;
  border-color: var(--accent);
}

/* ---------- System strip ---------- */
.system-strip {
  margin: var(--space-md) var(--space-lg) 0;
}

/* ---------- Terminal (fixed console look) ---------- */
.terminal-panel {
  background: var(--term-bg);
  border: none;
  border-top: 1px solid var(--term-border);
  border-radius: 0;
  box-shadow: none;
}

.terminal-header:hover { background: rgba(255, 255, 255, 0.03); }
.terminal-title { color: var(--term-muted); }
.terminal-dot { background: var(--term-success); }
.terminal-body { color: var(--term-muted); }
.terminal-line .prompt { color: var(--term-prompt); }
.terminal-line .path { color: var(--term-prompt); }
.terminal-line .output { color: var(--term-muted); }
.terminal-line .success { color: var(--term-success); }
.terminal-line .error-text { color: var(--term-error); }
.terminal-input { color: var(--term-text); caret-color: var(--term-prompt); }
.terminal-input-line .prompt { color: var(--term-prompt); }

/* ---------- View toggle (Board | Focus) ---------- */
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle-btn {
  height: 26px;
  padding: 0 14px;
  border: none;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
}

.view-toggle-btn + .view-toggle-btn {
  border-left: 1px solid var(--border-default);
}

.view-toggle-btn.active {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Queue search ---------- */
.queue-search {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.queue-search input {
  width: 100%;
  height: 28px;
  padding: 0 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-primary);
}

.queue-search input::placeholder { color: var(--text-muted); }

/* ---------- Focus view ---------- */
.focus-view {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  overflow: hidden;
  min-height: 0;
}

.focus-list-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.focus-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.focus-filters {
  display: inline-flex;
  gap: var(--space-xs);
}

.focus-filter {
  height: 24px;
  padding: 0 10px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.focus-filter.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.focus-filter-count {
  background: var(--count-bg);
  border-radius: 999px;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.focus-filter.active .focus-filter-count {
  background: transparent;
}

.focus-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-height: 0;
  padding-bottom: var(--space-sm);
}

.focus-item {
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
}

.focus-item-top {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.focus-item-meta {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-item-title {
  margin-top: var(--space-xs);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--text-primary);
}

.focus-rail {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  overflow-y: auto;
  min-height: 0;
}

.focus-card {
  padding: var(--space-md);
}

.focus-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.focus-drawer-state {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.focus-drawer-title {
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.4;
}

.focus-drawer-meta {
  margin-top: 2px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.focus-drawer-section {
  margin-top: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.focus-drawer-action {
  margin-top: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
}

.focus-drawer-buttons {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.focus-drawer-buttons .btn { text-decoration: none; }

.focus-agents-empty {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.focus-agent-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
}

.focus-agent-spinner {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: focus-pulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes focus-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.focus-scratchpad {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  padding: var(--space-sm);
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.5;
}
