/* ============================================================
   QUANTA Cockpit V3 — cross-page polish (loads LAST)
   Linear · Vercel · Apple restraint — flat, precise, quiet
   ============================================================ */

:root {
  --qds-row-radius: 10px;
  --qds-row-pad-y: 12px;
  --qds-row-pad-x: 14px;
}

/* ---- Canvas: remove honeycomb noise ---- */
body.qos-active {
  background:
    radial-gradient(72% 48% at 50% -18%, rgba(110, 139, 255, 0.055), transparent 58%),
    var(--qds-bg-app) !important;
  background-size: auto !important;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Kill AI-dashboard card lift (premium top layer) ---- */
.qos-card:hover,
.qos-panel:hover,
.qos-card.is-interactive:hover,
.qos-btn-primary:hover {
  transform: none !important;
}

/* ---- Sidebar: quieter, tighter ---- */
.qos-side {
  border-right: 1px solid var(--qds-border-hairline, rgba(255, 255, 255, 0.055));
  background: rgba(4, 5, 6, 0.92) !important;
  backdrop-filter: blur(12px);
}
.qos-nav-item {
  min-height: 34px;
  padding: 8px 10px !important;
  font-size: 13px;
  font-weight: 520;
  letter-spacing: -0.01em;
  color: var(--qds-text-secondary);
}
.qos-nav-item.is-active,
.qos-nav-item[aria-current="page"],
.qos-nav-item.active {
  color: var(--qds-text-primary);
  font-weight: 560;
}
.qos-nav-badge {
  font-size: 10px;
  font-weight: 650;
  min-width: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--qds-text-secondary);
}
.qos-nav-item.is-active .qos-nav-badge,
.qos-nav-item[aria-current="page"] .qos-nav-badge {
  background: rgba(110, 139, 255, 0.2);
  color: var(--qds-accent-ink, #aebcff);
}

/* ---- Page headers ---- */
.qos-view-head h1,
.qds-page-head h1 {
  font-size: 24px !important;
  font-weight: 620 !important;
  letter-spacing: -0.025em !important;
}
.qos-view-head p,
.qds-page-head p {
  font-size: 13px !important;
  color: var(--qds-text-tertiary) !important;
  line-height: 1.5 !important;
}

/* ---- Unified data rows (all list views) ---- */
.qi-inbox-row,
.qi-task-row,
.qi-appr-row,
.qi-pr-row,
.qi-repo-row,
.qi-dlog-row,
.qi-cicd-row,
.qi-meet-row,
.qos-list-item,
.qos-activity-v2-row {
  padding: var(--qds-row-pad-y) var(--qds-row-pad-x) !important;
  border-radius: var(--qds-row-radius) !important;
  gap: 12px !important;
  border: 1px solid transparent !important;
  transition: background 0.14s ease, border-color 0.14s ease !important;
}
.qi-inbox-row:hover,
.qi-task-row:hover,
.qi-appr-row:hover,
.qi-pr-row:hover,
.qi-repo-row:hover,
.qi-dlog-row:hover,
.qi-cicd-row:hover,
.qi-meet-row:hover,
.qos-list-item:hover {
  background: rgba(255, 255, 255, 0.028) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
.qi-inbox-row.is-selected,
.qi-task-row.is-selected,
.qi-appr-row.is-selected {
  background: rgba(110, 139, 255, 0.08) !important;
  border-color: rgba(110, 139, 255, 0.22) !important;
}

/* Row typography */
.qi-inbox-row-body b,
.qi-task-row b,
.qi-appr-row-title b,
.qi-pr-row-title b,
.qi-repo-row b,
.qi-dlog-row b {
  font-size: 13px !important;
  font-weight: 560 !important;
  letter-spacing: -0.01em;
}
.qi-inbox-row-body > span:not(.qi-inbox-row-meta),
.qi-task-row-meta,
.qi-appr-row-meta,
.qi-pr-row-meta {
  font-size: 12px !important;
  color: var(--qds-text-tertiary) !important;
}

/* Row marks — consistent 28px */
.qi-inbox-row-mark,
.qi-appr-row-mark,
.qi-pr-row-mark,
.qi-task-ic {
  width: 28px !important;
  height: 28px !important;
  border-radius: 8px !important;
}

/* ---- Stat / metric cards ---- */
.qos-stat-card,
.qos-home-metric,
.qi-inbox-stat,
.qi-task-stat,
.qi-appr-stat,
.qi-mc-stat {
  border-radius: var(--qds-radius-md) !important;
  box-shadow: var(--qds-surface-inset, inset 0 1px 0 rgba(255, 255, 255, 0.03)) !important;
}
.qos-stat-card__value,
.qi-inbox-stat b,
.qi-task-stat b {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em !important;
}

/* ---- Empty states ---- */
.qos-empty {
  border: 1px dashed rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.015) !important;
  padding: 40px 24px !important;
  max-width: 420px;
  margin: 24px auto;
}
.qos-empty h3 {
  font-size: 14px !important;
  font-weight: 560 !important;
  color: var(--qds-text-secondary) !important;
  letter-spacing: -0.01em;
}
.qos-empty p {
  font-size: 13px !important;
  color: var(--qds-text-tertiary) !important;
  line-height: 1.5 !important;
}
.qos-empty .qos-empty-ic {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  width: 52px !important;
  height: 52px !important;
  margin: 0 auto 12px !important;
  border-radius: 14px !important;
  background: rgba(110, 139, 255, 0.07) !important;
  border: 1px solid rgba(110, 139, 255, 0.15) !important;
  opacity: 1 !important;
  color: rgba(160, 170, 200, 0.65) !important;
}

/* ---- Buttons ---- */
.qos-btn {
  font-weight: 540 !important;
  letter-spacing: -0.01em;
}
.qos-btn.ghost {
  border-color: rgba(255, 255, 255, 0.1) !important;
}
.qos-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}
.qos-btn.primary,
.qos-btn-primary {
  font-weight: 580 !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 8px 20px -10px rgba(110, 139, 255, 0.55) !important;
}

/* ---- Activity Feed ---- */
.qos-af-view { gap: 12px; }
.qos-af-body-wrap { min-width: 0; }
.qos-af-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.qos-af-noise-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--qds-text-secondary, rgba(255, 255, 255, 0.65));
  cursor: pointer;
  user-select: none;
}
.qos-af-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-top: 8px;
  border-radius: 10px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.qos-af-banner.is-warn {
  background: rgba(251, 146, 60, 0.08);
  border-color: rgba(251, 146, 60, 0.25);
  color: #fdba74;
}
.qos-af-banner.is-crit {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}
.qos-global-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin: 0;
  border-bottom: 1px solid rgba(248, 113, 113, 0.25);
  background: rgba(248, 113, 113, 0.1);
  color: #fca5a5;
  font-size: 13px;
}
.qos-global-banner.is-crit {
  background: rgba(248, 113, 113, 0.1);
}
.qos-global-banner-text {
  flex: 1;
  min-width: 0;
}
.qos-meetings-view .qi-meet-oauth-alert {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.qos-meetings-view .qi-meet-oauth-alert.is-ok {
  background: rgba(52, 211, 153, 0.08);
  border-color: rgba(52, 211, 153, 0.25);
  color: #6ee7b7;
}
.qos-meetings-view .qi-meet-oauth-alert.is-error {
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}
.qpa-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.qpa-panel {
  position: fixed;
  right: 24px;
  bottom: 72px;
  width: min(420px, calc(100vw - 32px));
  z-index: 1201;
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(15, 17, 23, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
.qpa-panel.is-open { display: flex; }
.qpa-head { display: flex; align-items: center; gap: 8px; }
.qpa-head b { flex: 1; }
.qpa-close { background: none; border: none; color: inherit; font-size: 18px; cursor: pointer; }
.qpa-modes { display: flex; gap: 6px; flex-wrap: wrap; }
.qpa-mode {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
.qpa-mode.is-active {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.12);
}
.qpa-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  font-size: 14px;
}
.qpa-suggestions { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; }
.qpa-suggestion {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
.qpa-suggestion:hover { background: rgba(99, 102, 241, 0.12); }
.qos-af-sel {
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--qds-text-primary, #e9ebf0);
  font-size: 12.5px;
}
.qos-af-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.qos-af-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}
.qos-af-row.is-crit { border-color: rgba(248, 113, 113, 0.28); background: rgba(248, 113, 113, 0.06); }
.qos-af-row.is-warn { border-color: rgba(251, 146, 60, 0.24); background: rgba(251, 146, 60, 0.05); }
.qos-af-row.is-accent { border-color: rgba(110, 139, 255, 0.2); }
.qos-af-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.qos-af-body { min-width: 0; }
.qos-af-title {
  font-size: 13.5px;
  font-weight: 560;
  line-height: 1.35;
  color: var(--qds-text-primary, #e9ebf0);
  word-break: break-word;
}
.qos-af-detail {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--qds-text-secondary, rgba(255, 255, 255, 0.62));
}
.qos-af-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  min-width: 72px;
}
.qos-af-sev {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--qds-text-tertiary, rgba(255, 255, 255, 0.55));
}
.qos-af-sev.is-crit { color: #fca5a5; border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.1); }
.qos-af-sev.is-warn { color: #fdba74; border-color: rgba(251, 146, 60, 0.35); background: rgba(251, 146, 60, 0.08); }
.qos-af-sev.is-accent { color: #c8d4ff; border-color: rgba(110, 139, 255, 0.3); background: rgba(110, 139, 255, 0.08); }
.qos-af-ts {
  font-size: 11px;
  font-family: var(--qos-mono, ui-monospace, monospace);
  color: var(--qds-text-tertiary, rgba(255, 255, 255, 0.45));
  white-space: nowrap;
}
.qos-af-src {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--qds-text-tertiary, rgba(255, 255, 255, 0.35));
}
.qos-af-empty,
.qos-af-error,
.qos-af-loading {
  padding: 28px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  color: var(--qds-text-secondary, rgba(255, 255, 255, 0.62));
  text-align: center;
}
.qos-af-error { border-style: solid; border-color: rgba(248, 113, 113, 0.25); }
.qos-af-loading { display: flex; align-items: center; justify-content: center; gap: 10px; }

/* Safety net — brand tiles never blow up the viewport */
.qi-int-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  max-width: 48px;
  max-height: 48px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qi-int-logo-img,
.qos-brand-mark-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---- Integrations (protect logo tiles) ---- */
.qos-integrations-view .qi-int-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qos-integrations-view .qi-int-logo--sm {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.qos-integrations-view .qi-int-logo-img {
  width: 38px !important;
  height: 38px !important;
  padding: 0 !important;
  object-fit: contain !important;
  filter: none !important;
}
.qos-integrations-view .qi-int-logo--sm .qi-int-logo-img {
  width: 24px !important;
  height: 24px !important;
}
.qos-integrations-view .qi-int-logo--microsoft { background: #ffffff; }
.qos-integrations-view .qi-int-logo--linear .qi-int-logo-img {
  width: 70% !important;
  height: 70% !important;
}
.qos-integrations-view .qi-int-logo--github { background: #24292f; }
.qos-integrations-view .qi-int-logo--calendar { background: #ffffff; }
.qos-integrations-view .qi-int-logo--qdrant { background: #1a0a10; }
.qos-integrations-view .qi-int-logo--linear { background: #000000; }
.qos-integrations-view .qi-int-logo--slack { background: #ffffff; }
.qos-integrations-view .qi-int-logo--jira { background: #ffffff; }
.qos-integrations-view .qi-int-logo--datadog { background: #ffffff; }

.qos-integrations-view .qi-int-section-hint {
  margin: -4px 0 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--qds-text-tertiary, rgba(255, 255, 255, 0.45));
}
.qos-integrations-view .qi-int-oauth-alert {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}
.qos-integrations-view .qi-int-oauth-alert b {
  display: block;
  font-size: 13px;
  font-weight: 640;
  margin-bottom: 6px;
}
.qos-integrations-view .qi-int-oauth-alert p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--qds-text-secondary, rgba(255, 255, 255, 0.72));
}
.qos-integrations-view .qi-int-oauth-alert .qi-int-oauth-hint {
  margin-top: 8px;
  font-size: 12px;
  color: var(--qds-text-tertiary, rgba(255, 255, 255, 0.5));
}
.qos-integrations-view .qi-int-oauth-alert.is-error {
  border-color: rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.08);
}
.qos-integrations-view .qi-int-oauth-alert.is-ok {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.07);
}
.qos-integrations-view .qi-int-opt-chip {
  padding: 10px 14px 10px 10px !important;
  font-size: 12.5px !important;
  gap: 10px !important;
}

/* ---- Chat ---- */
.qi-bubble {
  border-radius: 14px !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
}
.qi-msg-row.user .qi-bubble {
  background: rgba(110, 139, 255, 0.14) !important;
  border: 1px solid rgba(110, 139, 255, 0.22) !important;
}

/* ---- Settings rows ---- */
.qos-settings-view .qi-set-pin-row,
.qos-settings-view .qi-set-account-row {
  border-radius: var(--qds-row-radius) !important;
  padding: 12px 14px !important;
}

/* ---- Toast ---- */
.qos-toast {
  backdrop-filter: blur(10px);
  background: rgba(15, 16, 20, 0.92) !important;
}

/* ---- Tables / thead ---- */
.qi-mc-thead,
.qi-appr-thead,
.qi-task-thead,
.qi-dlog-thead,
.qi-build-thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--qds-bg-surface);
}

.qos-integrations-view .qi-int-row-action.is-connect {
  border-color: rgba(110, 139, 255, 0.28) !important;
  color: var(--qos-accent) !important;
  background: rgba(110, 139, 255, 0.06) !important;
  box-shadow: none !important;
  font-weight: 560;
}
.qos-integrations-view .qi-int-row-action.is-connect:hover {
  border-color: rgba(110, 139, 255, 0.42) !important;
  color: #c8d4ff !important;
  background: rgba(110, 139, 255, 0.11) !important;
  filter: none !important;
  transform: none !important;
}

@media (max-width: 720px) {
  .qos-view { padding: 16px !important; }
  .qos-integrations-view .qi-int-logo { width: 44px; height: 44px; }
  .qos-integrations-view .qi-int-logo-img { width: 28px !important; height: 28px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .qi-inbox-row,
  .qi-task-row,
  .qi-appr-row,
  .qi-pr-row,
  .qos-btn,
  .qos-nav-item { transition: none !important; }
}

/* ---- Founder V4: queue-first home + calmer loading ---- */
.qos-home-top-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qos-home-strip-item.is-queue {
  border-color: rgba(240, 180, 41, 0.28);
  background: rgba(240, 180, 41, 0.06);
}
.qos-home-metrics .qos-home-metric.is-loading .qos-home-metric-value {
  color: var(--qds-text-tertiary);
  letter-spacing: 0.08em;
}
.qos-briefing-loading,
.qos-home-oi .qos-briefing-loading {
  font-size: 13px;
  color: var(--qds-text-tertiary);
  padding: 12px 0;
}
.qos-home-oi-cta {
  margin-top: 10px;
}
.qi-task-shell .qos-skel,
.qpq-skel {
  border-radius: 10px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.03) 0%,
    rgba(255, 255, 255, 0.06) 50%,
    rgba(255, 255, 255, 0.03) 100%
  ) !important;
  background-size: 200% 100% !important;
  animation: qds-shimmer 1.4s ease-in-out infinite;
}
@keyframes qds-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.qi-mc-alert.is-crit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(240, 96, 96, 0.28);
  background: rgba(240, 96, 96, 0.07);
}
.qi-mc-alert.is-crit b {
  color: #f06060;
  font-size: 13px;
}
.qi-mc-alert.is-crit span {
  flex: 1 1 200px;
  font-size: 12px;
  color: var(--qds-text-secondary);
  line-height: 1.45;
}
