/* ═══════════════════════════════════════════
   HQ Dashboard View Styles
   Two-column grid: metrics/projects/activity
   left, Chief of Staff chat right.
   Depends on tokens.css.
   ═══════════════════════════════════════════ */

.dashboard-view {
  flex: 1;
  overflow: auto;
}

.dashboard-inner {
  padding: 24px 28px;
  min-height: 100%;
}

/* ── Main grid ─────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: var(--space-6);
  align-items: start;
}

/* ── Left column ───────────────────────────── */
.dashboard-left {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

/* ── Greeting ──────────────────────────────── */
.dashboard-greeting {
  margin-bottom: var(--space-5);
}

.dashboard-greeting__name {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.1;
}

.dashboard-greeting__sub {
  font-size: var(--text-md);
  color: var(--color-dim);
  margin-top: 4px;
  line-height: 1.5;
}

.dashboard-greeting__sub strong {
  color: var(--color-red);
}

/* ── Metric grid ───────────────────────────── */
/* auto-fit lets the row grow from 4 to 5 tiles (Server Health added)
   without wrapping awkwardly. Collapses cleanly on narrow viewports. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-6);
}

/* ── Projects section ──────────────────────── */
.projects-section {
  margin-bottom: var(--space-6);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.project-card {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color var(--transition-base);
  /* border-top color set inline per project color */
  border-top-width: 3px;
}

.project-card:hover {
  border-color: var(--color-muted);
}

.project-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.project-card__name {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text);
}

.project-card__awaiting {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  background: #E8555533;
  color: var(--color-red);
  font-weight: 700;
}

.project-card__meta {
  font-size: var(--text-sm);
  color: var(--color-dim);
  margin-bottom: var(--space-2);
}

.project-card__progress-bar {
  width: 100%;
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  overflow: hidden;
}

.project-card__progress-fill {
  height: 100%;
  border-radius: 2px;
  /* background color set inline per project */
}

.project-card__footer {
  font-size: var(--text-sm);
  color: var(--color-dim);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
}

/* ── Activity section ──────────────────────── */
.activity-section {
  /* no bottom margin — it's the last element in the column */
}

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

.activity-view-all {
  background: transparent;
  border: none;
  color: var(--color-dim);
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: color var(--transition-fast);
  padding: 4px;
}

.activity-view-all:hover {
  color: var(--color-text);
}

.activity-feed {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.activity-item {
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item__time {
  font-size: var(--text-sm);
  color: var(--color-dim);
  font-family: var(--font-mono);
  min-width: 38px;
  padding-top: 2px;
  flex-shrink: 0;
}

.activity-item__body {
  flex: 1;
  min-width: 0;
}

.activity-item__meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.activity-item__agent {
  font-size: 11px;
  font-weight: 700;
}

.activity-item__msg {
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.4;
}

/* ── Right column — Chief chat ─────────────── */
.dashboard-chief {
  background: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  height: fit-content;
  max-height: calc(100vh - 180px);
  position: sticky;
  top: 0;
}

.chief-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.chief-header__info {
  flex: 1;
  min-width: 0;
}

.chief-header__name {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--color-text);
}

.chief-header__sub {
  font-size: var(--text-sm);
  color: var(--color-dim);
}

.chief-header__online {
  color: var(--color-green);
}

.chief-messages {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}

.chief-message {
  margin-bottom: 10px;
  font-size: var(--text-base);
  color: var(--color-text);
  line-height: 1.55;
}

.chief-message strong {
  color: var(--color-amber);
}

.chief-input {
  padding: 12px 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.chief-input__field {
  flex: 1;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 8px 10px;
  font-size: var(--text-base);
  outline: none;
  font-family: var(--font-body);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-base);
  min-height: 38px;
}

.chief-input__field:focus {
  border-color: var(--color-amber-glow);
}

.chief-input__send {
  background: var(--color-amber);
  color: var(--color-bg);
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: opacity var(--transition-fast);
  white-space: nowrap;
}

.chief-input__send:hover  { opacity: 0.9; }
.chief-input__send:active { opacity: 0.8; }

/* ── Mobile: single column ─────────────────── */
@media (max-width: 768px) {
  .dashboard-inner {
    padding: var(--space-4) var(--space-4);
  }

  /* Chief chat was sticky on desktop (column layout). On phone,
     stack it below metrics and cap its height so it doesn't
     dominate the viewport. Dashboard grid collapses via layout.css. */
  .dashboard-chief {
    max-height: 420px;
    position: static;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-greeting__name {
    font-size: 24px;
  }

  /* iOS auto-zoom prevention on the chief quick-reply input. */
  .chief-input__field {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .dashboard-inner {
    padding: var(--space-3);
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-2);
  }

  /* On very small screens let the Chief chat shrink further so it
     doesn't push the rest of the dashboard off-screen. */
  .dashboard-chief {
    max-height: 340px;
  }

  .dashboard-greeting__name {
    font-size: 22px;
  }

  /* Activity item time column narrower to save width. */
  .activity-item__time {
    min-width: 32px;
  }
}
